Add software update command examples (#442)

Add support for the OSUpdateStatus command
Add example Software Update API commands
This commit is contained in:
Scott Knight
2018-06-21 08:07:56 -04:00
committed by Victor Vrantchan
parent 24efe18538
commit 05344403a5
10 changed files with 60 additions and 6 deletions

View File

@@ -23,7 +23,8 @@ func (c *Command) MarshalJSON() ([]byte, error) {
"ManagedMediaList",
"DeviceConfigured",
"AvailableOSUpdates",
"NSExtensionMappings":
"NSExtensionMappings",
"OSUpdateStatus":
var x = struct {
RequestType string `json:"request_type"`
}{

View File

@@ -20,7 +20,8 @@ func (c *Command) MarshalPlist() (interface{}, error) {
"ManagedMediaList",
"DeviceConfigured",
"AvailableOSUpdates",
"NSExtensionMappings":
"NSExtensionMappings",
"OSUpdateStatus":
return &struct {
RequestType string
}{

View File

@@ -41,7 +41,8 @@ func commandToProto(cmd *Command) (*mdmproto.Command, error) {
"ManagedMediaList",
"DeviceConfigured",
"AvailableOSUpdates",
"NSExtensionMappings":
"NSExtensionMappings",
"OSUpdateStatus":
case "InstallProfile":
if cmd.InstallProfile == nil {

View File

@@ -46,7 +46,8 @@ func (c *Command) UnmarshalJSON(data []byte) error {
"ManagedMediaList",
"DeviceConfigured",
"AvailableOSUpdates",
"NSExtensionMappings":
"NSExtensionMappings",
"OSUpdateStatus":
return nil
case "InstallProfile":
var payload InstallProfile

View File

@@ -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

View File

@@ -28,7 +28,8 @@ func protoToCommand(pb *mdmproto.Command) *Command {
"ManagedMediaList",
"DeviceConfigured",
"AvailableOSUpdates",
"NSExtensionMappings":
"NSExtensionMappings",
"OSUpdateStatus":
case "InstallProfile":
cmd.InstallProfile = &InstallProfile{

View 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@-

View 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@-

View 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@-

View 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@-