mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-09 19:15:58 +08:00
Add software update command examples (#442)
Add support for the OSUpdateStatus command Add example Software Update API commands
This commit is contained in:
committed by
Victor Vrantchan
parent
24efe18538
commit
05344403a5
@@ -23,7 +23,8 @@ func (c *Command) MarshalJSON() ([]byte, error) {
|
||||
"ManagedMediaList",
|
||||
"DeviceConfigured",
|
||||
"AvailableOSUpdates",
|
||||
"NSExtensionMappings":
|
||||
"NSExtensionMappings",
|
||||
"OSUpdateStatus":
|
||||
var x = struct {
|
||||
RequestType string `json:"request_type"`
|
||||
}{
|
||||
|
||||
@@ -20,7 +20,8 @@ func (c *Command) MarshalPlist() (interface{}, error) {
|
||||
"ManagedMediaList",
|
||||
"DeviceConfigured",
|
||||
"AvailableOSUpdates",
|
||||
"NSExtensionMappings":
|
||||
"NSExtensionMappings",
|
||||
"OSUpdateStatus":
|
||||
return &struct {
|
||||
RequestType string
|
||||
}{
|
||||
|
||||
@@ -41,7 +41,8 @@ func commandToProto(cmd *Command) (*mdmproto.Command, error) {
|
||||
"ManagedMediaList",
|
||||
"DeviceConfigured",
|
||||
"AvailableOSUpdates",
|
||||
"NSExtensionMappings":
|
||||
"NSExtensionMappings",
|
||||
"OSUpdateStatus":
|
||||
|
||||
case "InstallProfile":
|
||||
if cmd.InstallProfile == nil {
|
||||
|
||||
@@ -46,7 +46,8 @@ func (c *Command) UnmarshalJSON(data []byte) error {
|
||||
"ManagedMediaList",
|
||||
"DeviceConfigured",
|
||||
"AvailableOSUpdates",
|
||||
"NSExtensionMappings":
|
||||
"NSExtensionMappings",
|
||||
"OSUpdateStatus":
|
||||
return nil
|
||||
case "InstallProfile":
|
||||
var payload InstallProfile
|
||||
|
||||
@@ -32,7 +32,8 @@ func (c *Command) UnmarshalPlist(unmarshal func(i interface{}) error) error {
|
||||
"ManagedMediaList",
|
||||
"DeviceConfigured",
|
||||
"AvailableOSUpdates",
|
||||
"NSExtensionMappings":
|
||||
"NSExtensionMappings",
|
||||
"OSUpdateStatus":
|
||||
return nil
|
||||
case "InstallProfile":
|
||||
var payload InstallProfile
|
||||
|
||||
@@ -28,7 +28,8 @@ func protoToCommand(pb *mdmproto.Command) *Command {
|
||||
"ManagedMediaList",
|
||||
"DeviceConfigured",
|
||||
"AvailableOSUpdates",
|
||||
"NSExtensionMappings":
|
||||
"NSExtensionMappings",
|
||||
"OSUpdateStatus":
|
||||
|
||||
case "InstallProfile":
|
||||
cmd.InstallProfile = &InstallProfile{
|
||||
|
||||
10
tools/api/commands/available_os_updates
Executable file
10
tools/api/commands/available_os_updates
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
source $MICROMDM_ENV_PATH
|
||||
endpoint="v1/commands"
|
||||
jq -n \
|
||||
--arg request_type "AvailableOSUpdates" \
|
||||
--arg udid "$1" \
|
||||
'.udid = $udid
|
||||
|.request_type = $request_type
|
||||
'|\
|
||||
curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@-
|
||||
10
tools/api/commands/os_update_status
Executable file
10
tools/api/commands/os_update_status
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
source $MICROMDM_ENV_PATH
|
||||
endpoint="v1/commands"
|
||||
jq -n \
|
||||
--arg request_type "OSUpdateStatus" \
|
||||
--arg udid "$1" \
|
||||
'.udid = $udid
|
||||
|.request_type = $request_type
|
||||
'|\
|
||||
curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@-
|
||||
16
tools/api/commands/schedule_os_update
Executable file
16
tools/api/commands/schedule_os_update
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
source $MICROMDM_ENV_PATH
|
||||
endpoint="v1/commands"
|
||||
jq -n \
|
||||
--arg request_type "ScheduleOSUpdate" \
|
||||
--arg udid "$1" \
|
||||
--arg product_key "$2" \
|
||||
--arg install_action "$3" \
|
||||
'.udid = $udid
|
||||
|.request_type = $request_type
|
||||
|.updates = [
|
||||
.product_key = $product_key
|
||||
|.install_action = $install_action
|
||||
]
|
||||
'|\
|
||||
curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@-
|
||||
12
tools/api/commands/schedule_os_update_scan
Executable file
12
tools/api/commands/schedule_os_update_scan
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
source $MICROMDM_ENV_PATH
|
||||
endpoint="v1/commands"
|
||||
jq -n \
|
||||
--arg request_type "ScheduleOSUpdateScan" \
|
||||
--arg udid "$1" \
|
||||
--argjson force "$2" \
|
||||
'.udid = $udid
|
||||
|.request_type = $request_type
|
||||
|.force = $force
|
||||
'|\
|
||||
curl -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@-
|
||||
Reference in New Issue
Block a user