Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions generator/classic/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ func (g *Generator) GenerateRegistry(resources []ClassicResource) (string, error

func templateFuncs() template.FuncMap {
return template.FuncMap{
"toCamel": strcase.ToCamel,
"toKebab": strcase.ToKebab,
"toLower": strings.ToLower,
"hasOp": hasOp,
"hasLookup": hasLookup,
"extraLookups": extraLookups,
"toCamel": strcase.ToCamel,
"toKebab": strcase.ToKebab,
"toLower": strings.ToLower,
"hasOp": hasOp,
"hasLookup": hasLookup,
"extraLookups": extraLookups,
"scopeResolveByList": func(r ClassicResource) bool { return !r.HasLookup("name") },
"classicExample": func(r ClassicResource, op string) string {
bin := "jamf-cli pro"
name := r.CLIName
Expand Down Expand Up @@ -371,8 +372,14 @@ func New{{ .GoName }}Cmd(ctx *registry.CLIContext) *cobra.Command {
{{- end }}
{{ if needsScope . }}
cmd.AddCommand(scope.NewScopeCmd(ctx, scope.Resource{
APIPath: "{{ .Path }}",
SingularKey: "{{ .Singular }}",
APIPath: "{{ .Path }}",
SingularKey: "{{ .Singular }}",
{{- if scopeResolveByList . }}
ResolveByList: true,
{{- end }}
{{- if .NoSubsetPut }}
NoSubsetPut: true,
{{- end }}
}))
{{- end }}

Expand Down
2 changes: 2 additions & 0 deletions generator/classic/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type manifestResource struct {
Operations []string `yaml:"operations"`
Lookups []string `yaml:"lookups"`
Scope bool `yaml:"scope"`
NoSubsetPut bool `yaml:"no_subset_put"`
IDPath string `yaml:"id_path"`
ListSubset string `yaml:"list_subset"`
GroupsPath string `yaml:"groups_path"`
Expand Down Expand Up @@ -114,6 +115,7 @@ func buildResource(entry manifestResource) (ClassicResource, error) {
Operations: operations,
Lookups: lookups,
HasScope: entry.Scope,
NoSubsetPut: entry.NoSubsetPut,
IDPath: idPath,
IsConfigProfile: entry.Path == "osxconfigurationprofiles" || entry.Path == "mobiledeviceconfigurationprofiles",
HasCustomPayload: entry.Path == "osxconfigurationprofiles",
Expand Down
1 change: 1 addition & 0 deletions generator/classic/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type ClassicResource struct {
Operations []string // ["list", "get", "create", "update", "delete"]
Lookups []string // ["id", "name", "serialnumber", "macaddress", "udid"]
HasScope bool // true if the resource supports scope operations
NoSubsetPut bool // true if the resource does not support /subset/Scope PUT (use full-doc PUT)
IDPath string // path segment between base path and ID value; defaults to "id" (e.g. "groupid" → /accounts/groupid/{id})
IsConfigProfile bool // true for macOS and mobile device configuration profile resources
HasCustomPayload bool // true only for osxconfigurationprofiles (supports --custom-payload-file)
Expand Down
2 changes: 2 additions & 0 deletions internal/commands/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ var proGroupMap = map[string]string{
"classic-restricted-software": groupClassicConfig,
"classic-allowed-file-extensions": groupClassicConfig,
"classic-mac-apps": groupClassicConfig,
"classic-ebooks": groupClassicConfig,
"classic-mobile-apps": groupClassicMobile,
"classic-ibeacons": groupClassicConfig,
"classic-classes": groupClassicConfig,
Expand All @@ -452,6 +453,7 @@ var proGroupMap = map[string]string{
"classic-distribution-points": groupClassicAdmin,
"classic-software-update-servers": groupClassicAdmin,
"classic-licensed-software": groupClassicAdmin,
"classic-user-groups": groupClassicAdmin,
"classic-user-ext-attrs": groupClassicAdmin,
"classic-vpp-accounts": groupClassicAdmin,
"classic-vpp-assignments": groupClassicAdmin,
Expand Down
2 changes: 2 additions & 0 deletions internal/commands/pro/generated/backup_registry.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading