devicemanagement

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActivityTypeAssignDevices   = "ASSIGN_DEVICES"
	ActivityTypeUnassignDevices = "UNASSIGN_DEVICES"
)

Activity type constants

View Source
const (
	ActivityStatusInProgress = "IN_PROGRESS"
	ActivityStatusCompleted  = "COMPLETED"
	ActivityStatusFailed     = "FAILED"
)

Activity status constants

View Source
const (
	ActivitySubStatusSubmitted  = "SUBMITTED"
	ActivitySubStatusProcessing = "PROCESSING"
)

Activity sub-status constants

View Source
const (
	FieldServerName      = "serverName"
	FieldServerType      = "serverType"
	FieldCreatedDateTime = "createdDateTime"
	FieldUpdatedDateTime = "updatedDateTime"
	FieldDevices         = "devices"
)

MDM Server field constants for field selection

Variables

This section is empty.

Functions

This section is empty.

Types

type AssignedServerLinks struct {
	Self    string `json:"self,omitempty"`
	Related string `json:"related,omitempty"`
}

AssignedServerLinks contains linkage navigation links

type DeviceManagementService

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

DeviceManagementService handles communication with the device management related methods of the Apple Business Manager API.

Apple Business Manager API docs: https://developer.apple.com/documentation/applebusinessmanagerapi/

func NewService

func NewService(client interfaces.HTTPClient) *DeviceManagementService

NewService creates a new device management service

func (*DeviceManagementService) AssignDevicesToServer

func (s *DeviceManagementService) AssignDevicesToServer(ctx context.Context, mdmServerID string, deviceIDs []string) (*ResponseOrgDeviceActivity, error)

AssignDevicesToServer assigns devices to an MDM server URL: POST https://api-business.apple.com/v1/orgDeviceActivities https://developer.apple.com/documentation/applebusinessmanagerapi/create-an-orgdeviceactivity

func (*DeviceManagementService) GetAssignedDeviceManagementServiceIDForADevice

func (s *DeviceManagementService) GetAssignedDeviceManagementServiceIDForADevice(ctx context.Context, deviceID string) (*ResponseOrgDeviceAssignedServerLinkage, error)

GetAssignedDeviceManagementServiceIDForADevice retrieves the assigned device management service ID linkage for a device URL: GET https://api-business.apple.com/v1/orgDevices/{id}/relationships/assignedServer https://developer.apple.com/documentation/applebusinessmanagerapi/get-the-assigned-device-management-service-id-for-an-orgdevice

func (*DeviceManagementService) GetAssignedDeviceManagementServiceInformationByDeviceID

func (s *DeviceManagementService) GetAssignedDeviceManagementServiceInformationByDeviceID(ctx context.Context, deviceID string, opts *RequestQueryOptions) (*MDMServerResponse, error)

GetAssignedDeviceManagementServiceInformationByDeviceID retrieves the assigned device management service information for a device URL: GET https://api-business.apple.com/v1/orgDevices/{id}/assignedServer https://developer.apple.com/documentation/applebusinessmanagerapi/get-the-assigned-device-management-service-information-for-an-orgdevice

func (*DeviceManagementService) GetDeviceManagementServices

func (s *DeviceManagementService) GetDeviceManagementServices(ctx context.Context, opts *RequestQueryOptions) (*ResponseMDMServers, error)

GetDeviceManagementServices retrieves a list of device management services (MDM servers) in an organization URL: GET https://api-business.apple.com/v1/mdmServers https://developer.apple.com/documentation/applebusinessmanagerapi/get-device-management-services

func (*DeviceManagementService) GetDeviceSerialNumbersForDeviceManagementService added in v0.3.0

func (s *DeviceManagementService) GetDeviceSerialNumbersForDeviceManagementService(ctx context.Context, mdmServerID string, opts *RequestQueryOptions) (*ResponseMDMServerDevicesLinkages, error)

GetDeviceSerialNumbersForDeviceManagementService retrieves a list of device IDs assigned to an MDM server URL: GET https://api-business.apple.com/v1/mdmServers/{id}/relationships/devices https://developer.apple.com/documentation/applebusinessmanagerapi/get-all-device-ids-for-a-device-management-service

func (*DeviceManagementService) UnassignDevicesFromServer

func (s *DeviceManagementService) UnassignDevicesFromServer(ctx context.Context, mdmServerID string, deviceIDs []string) (*ResponseOrgDeviceActivity, error)

UnassignDevicesFromServer unassigns devices from an MDM server URL: POST https://api-business.apple.com/v1/orgDeviceActivities https://developer.apple.com/documentation/applebusinessmanagerapi/create-an-orgdeviceactivity

type DeviceManagementServiceInterface

type DeviceManagementServiceInterface interface {
	// GetDeviceManagementServices retrieves a list of device management services (MDM servers) in an organization
	//
	// Apple Business Manager API docs:
	// https://developer.apple.com/documentation/applebusinessmanagerapi/get-device-management-services
	GetDeviceManagementServices(ctx context.Context, opts *RequestQueryOptions) (*ResponseMDMServers, error)

	// GetDeviceSerialNumbersForDeviceManagementService retrieves a list of device IDs assigned to an MDM server
	//
	// Apple Business Manager API docs:
	// https://developer.apple.com/documentation/applebusinessmanagerapi/get-all-device-ids-for-a-device-management-service
	GetDeviceSerialNumbersForDeviceManagementService(ctx context.Context, mdmServerID string, opts *RequestQueryOptions) (*ResponseMDMServerDevicesLinkages, error)

	// GetAssignedDeviceManagementServiceIDForADevice retrieves the assigned device management service ID linkage for a device
	//
	// Apple Business Manager API docs:
	// https://developer.apple.com/documentation/applebusinessmanagerapi/get-the-assigned-device-management-service-id-for-an-orgdevice
	GetAssignedDeviceManagementServiceIDForADevice(ctx context.Context, deviceID string) (*ResponseOrgDeviceAssignedServerLinkage, error)

	// GetAssignedDeviceManagementServiceInformationByDeviceID retrieves the assigned device management service information for a device
	//
	// Apple Business Manager API docs:
	// https://developer.apple.com/documentation/applebusinessmanagerapi/get-the-assigned-device-management-service-information-for-an-orgdevice
	GetAssignedDeviceManagementServiceInformationByDeviceID(ctx context.Context, deviceID string, opts *RequestQueryOptions) (*MDMServerResponse, error)

	// AssignDevicesToServer assigns devices to an MDM server
	//
	// Apple Business Manager API docs:
	// https://developer.apple.com/documentation/applebusinessmanagerapi/create-an-orgdeviceactivity
	AssignDevicesToServer(ctx context.Context, mdmServerID string, deviceIDs []string) (*ResponseOrgDeviceActivity, error)

	// UnassignDevicesFromServer unassigns devices from an MDM server
	//
	// Apple Business Manager API docs:
	// https://developer.apple.com/documentation/applebusinessmanagerapi/create-an-orgdeviceactivity
	UnassignDevicesFromServer(ctx context.Context, mdmServerID string, deviceIDs []string) (*ResponseOrgDeviceActivity, error)
}

DeviceManagementServiceInterface defines the interface for device management operations

type Links struct {
	Self  string `json:"self,omitempty"`
	First string `json:"first,omitempty"`
	Next  string `json:"next,omitempty"`
	Prev  string `json:"prev,omitempty"`
	Last  string `json:"last,omitempty"`
}

Links contains navigation links for API responses

type MDMServer

type MDMServer struct {
	ID            string                  `json:"id"`
	Type          string                  `json:"type"`
	Attributes    *MDMServerAttributes    `json:"attributes,omitempty"`
	Relationships *MDMServerRelationships `json:"relationships,omitempty"`
}

MDMServer represents an MDM server in the Apple Business Manager system

type MDMServerAttributes

type MDMServerAttributes struct {
	ServerName      string     `json:"serverName,omitempty"`
	ServerType      string     `json:"serverType,omitempty"`
	CreatedDateTime *time.Time `json:"createdDateTime,omitempty"`
	UpdatedDateTime *time.Time `json:"updatedDateTime,omitempty"`
	Devices         []string   `json:"devices,omitempty"`
}

MDMServerAttributes contains the MDM server attributes

type MDMServerDeviceLinkage

type MDMServerDeviceLinkage struct {
	Type string `json:"type"` // Should be "orgDevices"
	ID   string `json:"id"`   // Device ID
}

MDMServerDeviceLinkage represents a device linkage in the MDM server relationships

type MDMServerDevicesLinks struct {
	Self string `json:"self,omitempty"`
}

MDMServerDevicesLinks contains the navigation links for devices

type MDMServerDevicesRelationship

type MDMServerDevicesRelationship struct {
	Links *MDMServerDevicesLinks `json:"links,omitempty"`
}

MDMServerDevicesRelationship contains the devices relationship links

type MDMServerRelationships

type MDMServerRelationships struct {
	Devices *MDMServerDevicesRelationship `json:"devices,omitempty"`
}

MDMServerRelationships contains the MDM server relationships

type MDMServerResponse

type MDMServerResponse struct {
	Data  MDMServer `json:"data"`
	Links *Links    `json:"links,omitempty"`
}

MDMServerResponse represents the response for getting a single MDM server

type Meta

type Meta struct {
	Paging *Paging `json:"paging,omitempty"`
}

Meta represents pagination metadata

type OrgDeviceActivity

type OrgDeviceActivity struct {
	ID         string                       `json:"id"`
	Type       string                       `json:"type"`
	Attributes *OrgDeviceActivityAttributes `json:"attributes,omitempty"`
	Links      *OrgDeviceActivityLinks      `json:"links,omitempty"`
}

OrgDeviceActivity represents a device activity (assign/unassign operations)

type OrgDeviceActivityAttributes

type OrgDeviceActivityAttributes struct {
	Status          string     `json:"status,omitempty"`
	SubStatus       string     `json:"subStatus,omitempty"`
	CreatedDateTime *time.Time `json:"createdDateTime,omitempty"`
	ActivityType    string     `json:"activityType,omitempty"`
}

OrgDeviceActivityAttributes contains the activity attributes

type OrgDeviceActivityCreateAttributes

type OrgDeviceActivityCreateAttributes struct {
	ActivityType string `json:"activityType"`
}

OrgDeviceActivityCreateAttributes contains the activity creation attributes

type OrgDeviceActivityCreateRelationships

type OrgDeviceActivityCreateRelationships struct {
	MDMServer *OrgDeviceActivityMDMServerRelationship `json:"mdmServer,omitempty"`
	Devices   *OrgDeviceActivityDevicesRelationship   `json:"devices,omitempty"`
}

OrgDeviceActivityCreateRelationships contains the relationships for activity creation

type OrgDeviceActivityCreateRequest

type OrgDeviceActivityCreateRequest struct {
	Data OrgDeviceActivityData `json:"data"`
}

OrgDeviceActivityCreateRequest represents the request for creating a device activity

type OrgDeviceActivityData

type OrgDeviceActivityData struct {
	Type          string                               `json:"type"`
	Attributes    OrgDeviceActivityCreateAttributes    `json:"attributes"`
	Relationships OrgDeviceActivityCreateRelationships `json:"relationships"`
}

OrgDeviceActivityData contains the activity data for the request

type OrgDeviceActivityDeviceLinkage

type OrgDeviceActivityDeviceLinkage struct {
	Type string `json:"type"` // Should be "orgDevices"
	ID   string `json:"id"`   // Device ID
}

OrgDeviceActivityDeviceLinkage represents a device linkage

type OrgDeviceActivityDevicesRelationship

type OrgDeviceActivityDevicesRelationship struct {
	Data []OrgDeviceActivityDeviceLinkage `json:"data"`
}

OrgDeviceActivityDevicesRelationship represents the devices relationship

type OrgDeviceActivityLinks struct {
	Self string `json:"self,omitempty"`
}

OrgDeviceActivityLinks contains activity navigation links

type OrgDeviceActivityMDMServerLinkage

type OrgDeviceActivityMDMServerLinkage struct {
	Type string `json:"type"` // Should be "mdmServers"
	ID   string `json:"id"`   // MDM Server ID
}

OrgDeviceActivityMDMServerLinkage represents the MDM server linkage

type OrgDeviceActivityMDMServerRelationship

type OrgDeviceActivityMDMServerRelationship struct {
	Data OrgDeviceActivityMDMServerLinkage `json:"data"`
}

OrgDeviceActivityMDMServerRelationship represents the MDM server relationship

type OrgDeviceAssignedServerLinkage

type OrgDeviceAssignedServerLinkage struct {
	Type string `json:"type"` // Should be "mdmServers"
	ID   string `json:"id"`   // MDM Server ID
}

OrgDeviceAssignedServerLinkage represents the linkage between a device and its assigned server

type Paging

type Paging struct {
	Total      int    `json:"total,omitempty"`
	Limit      int    `json:"limit,omitempty"`
	NextCursor string `json:"nextCursor,omitempty"`
}

Paging contains pagination information

type RequestQueryOptions

type RequestQueryOptions struct {
	// Field selection - fields to return for mdmServers
	// Possible values: serverName, serverType, createdDateTime, updatedDateTime, devices
	Fields []string `json:"fields,omitempty"`

	// Limit the number of included related resources to return (max 1000)
	Limit int `json:"limit,omitempty"`
}

RequestQueryOptions represents the query parameters for getting MDM servers

type ResponseMDMServerDevicesLinkages

type ResponseMDMServerDevicesLinkages struct {
	Data  []MDMServerDeviceLinkage `json:"data"`
	Links *Links                   `json:"links,omitempty"`
	Meta  *Meta                    `json:"meta,omitempty"`
}

ResponseMDMServerDevicesLinkages represents the response for getting device linkages for an MDM server

type ResponseMDMServers

type ResponseMDMServers struct {
	Data  []MDMServer `json:"data"`
	Meta  *Meta       `json:"meta,omitempty"`
	Links *Links      `json:"links,omitempty"`
}

ResponseMDMServers represents the response for getting MDM servers

type ResponseOrgDeviceActivity

type ResponseOrgDeviceActivity struct {
	Data  OrgDeviceActivity `json:"data"`
	Links *Links            `json:"links,omitempty"`
}

ResponseOrgDeviceActivity represents the response for creating an org device activity

type ResponseOrgDeviceAssignedServerLinkage

type ResponseOrgDeviceAssignedServerLinkage struct {
	Data  OrgDeviceAssignedServerLinkage `json:"data"`
	Links *AssignedServerLinks           `json:"links,omitempty"`
}

ResponseOrgDeviceAssignedServerLinkage represents the response for getting assigned server linkage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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