feat(comp): migrate Classic computer MDM commands to modern API and add restart, shutdown, set-recovery-lock - #74
Merged
neilmartin83 merged 2 commits intoApr 6, 2026
Conversation
…dd restart, shutdown, set-recovery-lock Migrated from deprecated Classic API to modern POST /v2/mdm/commands: - lock → DEVICE_LOCK - enable-remote-desktop → ENABLE_REMOTE_DESKTOP (Classic deprecated 2025-07-10) - disable-remote-desktop → DISABLE_REMOTE_DESKTOP (Classic deprecated 2025-07-10) New commands: - restart (RESTART_DEVICE) — optional --rebuild-kernel-cache flag - shutdown (SHUT_DOWN_DEVICE) - set-recovery-lock (SET_RECOVERY_LOCK) — optional --new-password; omit to clear sendMDMCommand retained in pro_bulk.go for the bulk send-command operation only. Closes #73 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Setting an unknown Recovery Lock password can permanently lock a user out of their machine. Require --yes (single device) and --confirm-destructive (bulk) consistent with other destructive operations like lock and erase. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Applies the same Classic → Modern API migration rules as #72, now for computer MDM commands.
Migrated (Classic → Modern)
commandTypelock/JSSResource/computercommands/command/DeviceLock/id/{id}DEVICE_LOCKenable-remote-desktop/JSSResource/computercommands/command/EnableRemoteDesktop/id/{id}ENABLE_REMOTE_DESKTOPdisable-remote-desktop/JSSResource/computercommands/command/DisableRemoteDesktop/id/{id}DISABLE_REMOTE_DESKTOPNew commands
commandTyperestartRESTART_DEVICE--rebuild-kernel-cacheflagshutdownSHUT_DOWN_DEVICEset-recovery-lockSET_RECOVERY_LOCK--new-password; omit to clearsendMDMCommandretained inpro_bulk.go— still needed by bulksend-commandoperation.Test plan
make test)restart,enable-remote-desktop,disable-remote-desktop,lock,shutdown(dry-run),set-recovery-locklive-tested on nmartin.jamfcloud.com — all returned command UUIDsTestComputerActionSubcommands_Existcovers all 12 computer action commandsTestSendComputerModernMDMCommand_Successasserts correctcommandTypeandmanagementIdin request bodyTestSendComputerModernMDMCommand_MissingManagementIDasserts correct errorCloses #73
🤖 Generated with Claude Code