Documentation
¶
Index ¶
- Variables
- func BoundedParallelFetch[T any, R any](ctx context.Context, items []T, concurrency int, ...) ([]R, []error)
- func DeduplicateSlug(slug string, seen map[string]bool) string
- func FetchAllPaginated(ctx context.Context, client registry.HTTPClient, basePath string, pageSize int) ([]map[string]any, error)
- func FetchClassicList(ctx context.Context, client registry.HTTPClient, path, wrapperKey string) ([]any, error)
- func FetchJSON(ctx context.Context, client registry.HTTPClient, path string) (map[string]any, error)
- func FormatError(err error) bool
- func NewRootCmd(version, commit, date string) *cobra.Command
- func ResolveAuthForProfile(cfg *config.Config, params AuthParams) (string, auth.Provider, error)
- func SlugifyName(name string) string
- func StripServerFields(obj map[string]any) map[string]any
- type AuthParams
- type FetchResult
- type ResourceDef
Constants ¶
This section is empty.
Variables ¶
var BackupResources = []ResourceDef{ { Name: "policies", ListPath: "/JSSResource/policies", GetPath: "/JSSResource/policies/id/{id}", WrapperKey: "policies", IsClassic: true, SubDir: "policies", }, { Name: "profiles", ListPath: "/JSSResource/osxconfigurationprofiles", GetPath: "/JSSResource/osxconfigurationprofiles/id/{id}", WrapperKey: "os_x_configuration_profiles", IsClassic: true, SubDir: "profiles/macos", }, { Name: "profiles", ListPath: "/JSSResource/mobiledeviceconfigurationprofiles", GetPath: "/JSSResource/mobiledeviceconfigurationprofiles/id/{id}", WrapperKey: "configuration_profiles", IsClassic: true, SubDir: "profiles/ios", }, { Name: "scripts", ListPath: "/v1/scripts", GetPath: "/v1/scripts/{id}", SubDir: "scripts", }, { Name: "extension-attributes", ListPath: "/JSSResource/computerextensionattributes", GetPath: "/JSSResource/computerextensionattributes/id/{id}", WrapperKey: "computer_extension_attributes", IsClassic: true, SubDir: "extension-attributes/computer", }, { Name: "extension-attributes", ListPath: "/JSSResource/mobiledeviceextensionattributes", GetPath: "/JSSResource/mobiledeviceextensionattributes/id/{id}", WrapperKey: "mobile_device_extension_attributes", IsClassic: true, SubDir: "extension-attributes/mobile", }, { Name: "smart-groups", ListPath: "/v1/computer-groups", GetPath: "/v1/computer-groups/{id}", SubDir: "smart-groups/computers", }, { Name: "smart-groups", ListPath: "/v1/mobile-device-groups/smart-groups", GetPath: "/v1/mobile-device-groups/{id}", SubDir: "smart-groups/mobile", }, { Name: "categories", ListPath: "/v1/categories", GetPath: "/v1/categories/{id}", SubDir: "categories", }, { Name: "buildings", ListPath: "/v1/buildings", GetPath: "/v1/buildings/{id}", SubDir: "buildings", }, { Name: "departments", ListPath: "/v1/departments", GetPath: "/v1/departments/{id}", SubDir: "departments", }, { Name: "sites", ListPath: "/v1/sites", GetPath: "/v1/sites/{id}", SubDir: "sites", }, { Name: "packages", ListPath: "/JSSResource/packages", GetPath: "/JSSResource/packages/id/{id}", WrapperKey: "packages", IsClassic: true, SubDir: "packages", }, { Name: "printers", ListPath: "/JSSResource/printers", GetPath: "/JSSResource/printers/id/{id}", WrapperKey: "printers", IsClassic: true, SubDir: "printers", }, { Name: "dock-items", ListPath: "/JSSResource/dockitems", GetPath: "/JSSResource/dockitems/id/{id}", WrapperKey: "dock_items", IsClassic: true, SubDir: "dock-items", }, { Name: "network-segments", ListPath: "/JSSResource/networksegments", GetPath: "/JSSResource/networksegments/id/{id}", WrapperKey: "network_segments", IsClassic: true, SubDir: "network-segments", }, { Name: "restricted-software", ListPath: "/JSSResource/restrictedsoftware", GetPath: "/JSSResource/restrictedsoftware/id/{id}", WrapperKey: "restricted_software", IsClassic: true, SubDir: "restricted-software", }, { Name: "disk-encryption", ListPath: "/JSSResource/diskencryptionconfigurations", GetPath: "/JSSResource/diskencryptionconfigurations/id/{id}", WrapperKey: "disk_encryption_configurations", IsClassic: true, SubDir: "disk-encryption", }, { Name: "patch-titles", ListPath: "/JSSResource/patchsoftwaretitles", GetPath: "/JSSResource/patchsoftwaretitles/id/{id}", WrapperKey: "patch_software_titles", IsClassic: true, SubDir: "patch-titles", }, { Name: "static-groups", ListPath: "/v1/computer-groups", GetPath: "/v1/computer-groups/{id}", SubDir: "static-groups/computers", }, }
BackupResources lists all resource types that the backup command exports. Ordered by logical grouping: policies/profiles first, then supporting objects.
Functions ¶
func BoundedParallelFetch ¶
func BoundedParallelFetch[T any, R any](ctx context.Context, items []T, concurrency int, fn func(context.Context, T) (R, error)) ([]R, []error)
BoundedParallelFetch runs fn for each item with bounded concurrency. Returns all results (in input order) and any errors collected.
func DeduplicateSlug ¶
DeduplicateSlug appends a numeric suffix if slug already exists in the set. Returns the unique slug and adds it to the set.
func FetchAllPaginated ¶
func FetchAllPaginated(ctx context.Context, client registry.HTTPClient, basePath string, pageSize int) ([]map[string]any, error)
FetchAllPaginated fetches all items from a modern API endpoint. It auto-detects the response format:
- Paginated: `{"totalCount": N, "results": [...]}` — fetches all pages
- Array: `[{...}, {...}]` — returns the full array directly
Some Jamf Pro endpoints (e.g. /v1/sites, /v1/computer-groups, /v2/patch-software-title-configurations) return plain arrays even when pagination params are provided. This function handles both transparently.
func FetchClassicList ¶
func FetchClassicList(ctx context.Context, client registry.HTTPClient, path, wrapperKey string) ([]any, error)
FetchClassicList performs a GET on a Classic API list endpoint and returns the unwrapped array. Classic API returns XML; JSON is handled as a fallback.
func FetchJSON ¶
func FetchJSON(ctx context.Context, client registry.HTTPClient, path string) (map[string]any, error)
FetchJSON performs a GET request and returns the parsed JSON object. Exported version of the overview.go fetchJSON helper.
func FormatError ¶
FormatError writes a structured JSON error to stdout when the output format is "json". Returns true if the error was handled, false otherwise (caller should fall back to plain stderr).
func NewRootCmd ¶
func ResolveAuthForProfile ¶
ResolveAuthForProfile determines the server URL and auth provider for a specific profile name using the given config. Unlike resolveAuth, it does not read or mutate package-level variables, making it safe to call multiple times for different profiles (e.g., in the diff command).
func SlugifyName ¶
SlugifyName converts a display name to a filesystem-safe slug. "Deploy Chrome - v1.2" → "deploy-chrome-v1-2"
Types ¶
type AuthParams ¶
type AuthParams struct {
Profile string
ServerURL string
Token string
TokenFile string
TokenStdin bool
ClientID string
ClientSecret string
TenantID string
}
AuthParams holds all auth-related inputs for profile resolution. Enables callers (like diff) to resolve multiple profiles independently.
type FetchResult ¶
FetchResult holds either a result or an error from a parallel fetch.
type ResourceDef ¶
type ResourceDef struct {
Name string // CLI display name: "policies"
ListPath string // API list endpoint: "/JSSResource/policies" or "/v1/scripts"
GetPath string // API detail endpoint with {id} placeholder
WrapperKey string // Classic API JSON wrapper key (empty for modern)
IsClassic bool
SubDir string // backup output subdirectory
}
ResourceDef describes an API resource for backup/diff operations.
func FilterResources ¶
func FilterResources(resources []ResourceDef, names []string) []ResourceDef
FilterResources returns only resources whose Name matches one of the given names.
Source Files
¶
- aliases.go
- completion.go
- config.go
- groups.go
- multi.go
- platform.go
- pro.go
- pro_audit.go
- pro_backup.go
- pro_blueprints.go
- pro_bulk.go
- pro_bulk_commands.go
- pro_bulk_groups.go
- pro_bulk_policies.go
- pro_command_flush.go
- pro_compliance_benchmarks.go
- pro_ddm_reports.go
- pro_device.go
- pro_device_actions.go
- pro_device_resolve.go
- pro_diff.go
- pro_group_tools.go
- pro_helpers.go
- pro_overview.go
- pro_packages_upload.go
- pro_platform_device_groups.go
- pro_platform_devices.go
- pro_platform_helpers.go
- pro_profiles_upload.go
- pro_report.go
- pro_report_compliance.go
- pro_report_ea.go
- pro_report_inventory.go
- pro_report_mdm.go
- pro_report_patch.go
- pro_report_platform.go
- pro_report_policy.go
- pro_report_security.go
- pro_report_software.go
- pro_report_updates.go
- pro_resources.go
- pro_scripts_upload.go
- pro_setup.go
- protect.go
- protect_action_configs.go
- protect_alerts.go
- protect_analytic_sets.go
- protect_analytics.go
- protect_api_clients.go
- protect_audit_logs.go
- protect_auth.go
- protect_computers.go
- protect_exception_sets.go
- protect_groups.go
- protect_helpers.go
- protect_insights.go
- protect_org.go
- protect_overview.go
- protect_permissions.go
- protect_plans.go
- protect_prevent_lists.go
- protect_roles.go
- protect_rscs.go
- protect_setup.go
- protect_telemetry.go
- protect_ulf.go
- protect_users.go
- root.go