deviceactions

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package deviceactions provides typed access to Jamf Platform deviceactions API endpoints.

Index

Constants

This section is empty.

Variables

View Source
var Privileges = map[string]jamfplatform.MethodPrivileges{
	"CheckInDevice":  {Method: "CheckInDevice", HTTPMethod: "POST", Path: "/v1/devices/{id}/check-in", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-actions:execute"}, Legacy: nil, Source: "spec"},
	"EraseDevice":    {Method: "EraseDevice", HTTPMethod: "POST", Path: "/v1/devices/{id}/erase", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"destructive-device-actions:execute"}, Legacy: nil, Source: "spec"},
	"RestartDevice":  {Method: "RestartDevice", HTTPMethod: "POST", Path: "/v1/devices/{id}/restart", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-actions:execute"}, Legacy: nil, Source: "spec"},
	"ShutdownDevice": {Method: "ShutdownDevice", HTTPMethod: "POST", Path: "/v1/devices/{id}/shutdown", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-actions:execute"}, Legacy: nil, Source: "spec"},
	"UnmanageDevice": {Method: "UnmanageDevice", HTTPMethod: "POST", Path: "/v1/devices/{id}/unmanage", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"destructive-device-actions:execute"}, Legacy: nil, Source: "spec"},
}

Privileges maps each deviceactions SDK method name to the Jamf API privileges it requires, sourced from the x-required-privileges vendor extensions in the Jamf OpenAPI specs. Identifiers are GA capability permissions in {capability}:{action} form and a multi-entry Scoped slice means all of them are required.

Source names where each entry's Scoped set came from: "spec" for the operation's own x-required-privileges, "gateway-policy" for one the published spec omits and this SDK supplies from the gateway's authorization policy, and "" when Scoped is empty. An empty Scoped slice means nothing declares a privilege for the endpoint, which is NOT the same as none being required — see jamfplatform.MethodPrivileges. Do not render it as "no permission needed".

Scopes lists the scope kinds each endpoint accepts. It is an alternatives set: a client carries one scope, so a consumer needs a credential matching one of the listed kinds. ScopesSource names where the set came from — "spec" for the spec root's own x-scope-types, "config-override" for one this SDK supplies because the published spec understates what the gateway serves or declares no extension at all. A spec-sourced set is what the spec declares, which for the Platform APIs is currently stricter than the gateway — see jamfplatform.MethodPrivileges.

Synthetic Resolve<X>ByName / Apply<X> methods are not present; document the privileges of the operations they call instead.

Functions

func PrivilegesFor

func PrivilegesFor(method string) (jamfplatform.MethodPrivileges, bool)

PrivilegesFor returns the privilege metadata for the named SDK method and true when the method is present in the registry, or the zero value and false otherwise.

Types

type ApiError

type ApiError struct {
	Errors []ApiErrorErrorsItem `json:"errors"`
	// HTTP status of the response.
	HttpStatus int    `json:"httpStatus"`
	TraceID    string `json:"traceId"`
}

ApiError Standard error response returned when a request cannot be completed.

type ApiErrorErrorsItem

type ApiErrorErrorsItem struct {
	// Error-specific code that can be used to identify localization string, etc.
	Code string `json:"code"`
	// A general description of error for troubleshooting/debugging. Generally this text should not be
	// displayed to a user; instead refer to errorCode and its localized text.
	Description string `json:"description"`
	// Name of the field that caused the error.
	Field string `json:"field"`
	// id of object with error. Optional.
	ID string `json:"id"`
}

ApiErrorErrorsItem represents a api error errors item.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides typed methods for deviceactions operations.

func New

func New(base *jamfplatform.Client) *Client

New creates a deviceactions client that shares the authenticated transport of the given root client.

func (*Client) CheckInDevice

func (c *Client) CheckInDevice(ctx context.Context, id string) error

CheckInDevice request a device check in.

Required privileges: device-actions:execute.

Parameters:

  • id: The ID of the device, in UUID format.

func (*Client) EraseDevice

func (c *Client) EraseDevice(ctx context.Context, id string, request *EraseDeviceRequest) ([]DeviceCommandResponse, error)

EraseDevice erase a device.

Required privileges: destructive-device-actions:execute.

Parameters:

  • id: The ID of the device, in UUID format.

func (*Client) RestartDevice

func (c *Client) RestartDevice(ctx context.Context, id string) ([]DeviceCommandResponse, error)

RestartDevice restart a device.

Required privileges: device-actions:execute.

Parameters:

  • id: The ID of the device, in UUID format.

func (*Client) ShutdownDevice

func (c *Client) ShutdownDevice(ctx context.Context, id string) ([]DeviceCommandResponse, error)

ShutdownDevice shut down a device.

Required privileges: device-actions:execute.

Parameters:

  • id: The ID of the device, in UUID format.

func (*Client) UnmanageDevice

func (c *Client) UnmanageDevice(ctx context.Context, id string) ([]DeviceCommandResponse, error)

UnmanageDevice unmanage a device.

Required privileges: destructive-device-actions:execute.

Parameters:

  • id: The ID of the device, in UUID format.

type DeviceCommandResponse

type DeviceCommandResponse struct {
	// The ID of the command that was created to perform the requested action.
	CommandID string `json:"commandId"`
	// The ID of the device to which the command was sent.
	DeviceID string `json:"deviceId"`
}

DeviceCommandResponse The result of a management action command issued to a device, including the created command's identifier.

type EraseDeviceRequest

type EraseDeviceRequest struct {
	// Clear the activation lock on the device. Applies to mobile devices only.
	ClearActivationLock *bool `json:"clearActivationLock,omitempty"`
	// If 'true', disable Proximity Setup on the next reboot and skip the pane in Setup Assistant. Applies
	// to mobile devices only.
	DisallowProximitySetup *bool `json:"disallowProximitySetup,omitempty"`
	// The six-character PIN for Find My. Applies to computers only.
	Pin *string `json:"pin,omitempty"`
	// If 'true', preserve the data plan on an iPhone or iPad with eSIM functionality, if one exists.
	// Applies to mobile devices only.
	PreserveDataPlan *bool `json:"preserveDataPlan,omitempty"`
	// If 'true', the device will be returned to service after the erase is complete. Applies to mobile
	// devices only.
	ReturnToService *bool `json:"returnToService,omitempty"`
}

EraseDeviceRequest Options that control how a device is erased.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL