Skip to content

feat(backup): add inventory preload CSV export and app store app backup#202

Merged
neilmartin83 merged 2 commits into
mainfrom
feat/backup-inventory-preload-and-app-store
May 12, 2026
Merged

feat(backup): add inventory preload CSV export and app store app backup#202
neilmartin83 merged 2 commits into
mainfrom
feat/backup-inventory-preload-and-app-store

Conversation

@neilmartin83
Copy link
Copy Markdown
Member

@neilmartin83 neilmartin83 commented May 11, 2026

Summary

  • Inventory preload (Feature Request: add Inventory preload to the backup command #200): downloaded as a single CSV via GET /v2/inventory-preload/csvinventory-preloads/inventory-preload-all.csv. The API provides the full dataset in one request; per-record JSON list+get is not the right approach here.
  • Mac App Store / mobile device apps (Feature Request: add Inventory preload to the backup command #200, Feature Request: Add Jamf Pro macapplications & mobiledeviceapplications #201): classic-mac-apps and classic-mobile-apps were already generated and wired — this PR adds them to the backup resource list so they appear in backup output under mac-apps/ and mobile-apps/.
  • serialNumber name field for inventory-preloads: enables --name <serial> lookups on the generated command and correct file naming in future JSON-based operations.
  • Filter guard fix: runBackup's "no resources match filter" guard now calls isKnownBackupFilter so --resources inventory-preloads (and blueprints, compliance-benchmarks) no longer false-errors before those handlers run.
  • BackupFilterNames updated to include non-standard filter names for accurate shell completion.

Tested on live instance (platform-nmartin)

$ bin/jamf-cli -p platform-nmartin pro backup --output /tmp/backup-test --resources inventory-preloads
Backup complete: 1 objects exported

Output: inventory-preloads/inventory-preload-all.csv with correct CSV headers and data.

$ bin/jamf-cli -p platform-nmartin pro backup --output /tmp/backup-test2 --resources mac-apps,mobile-apps
Backup complete: 65 objects exported

Output: mac-apps/ and mobile-apps/ directories with per-app YAML files.

Test plan

  • TestBackupInventoryPreloadCSV_Success — CSV written to correct path with correct content
  • TestBackupInventoryPreloadCSV_HTTPError — HTTP 403 produces failure record, not silent bad file
  • TestBackup_InventoryPreloadFilterrunBackup with Resources: "inventory-preloads" completes without error
  • TestBackupFilterNames — asserts mac-apps, mobile-apps, inventory-preloads, blueprints, compliance-benchmarks all present
  • TestBackupResources_AllKeysRegistered — catches classic-mac-apps / classic-mobile-apps key drift
  • make test passes

Closes #200
Closes #201

🤖 Generated with Claude Code

Add backup support for three resource types:
- Inventory preload records via single CSV download (GET /v2/inventory-preload/csv)
  rather than paginated JSON list+get, writing inventory-preloads/inventory-preload-all.csv
- Mac App Store apps (classic-mac-apps → mac-apps/)
- Mobile device apps (classic-mobile-apps → mobile-apps/)

Also fixes the filter guard in runBackup to allow non-standard filter names
(inventory-preloads, blueprints, compliance-benchmarks) that are handled outside
BackupResources. Adds isKnownBackupFilter and nonStandardBackupFilters to
pro_resources.go so BackupFilterNames stays accurate for shell completion.

Adds serialNumber as the name field override for inventory-preloads so
--name <serial> lookups work on the generated command.

Closes #200
Closes #201

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@neilmartin83 neilmartin83 merged commit b49c806 into main May 12, 2026
1 check passed
@neilmartin83 neilmartin83 deleted the feat/backup-inventory-preload-and-app-store branch May 12, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add Jamf Pro macapplications & mobiledeviceapplications Feature Request: add Inventory preload to the backup command

2 participants