devicemanagement

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 7 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"
	FieldEnableMdmDisownFlag    = "enableMdmDisownFlag"
	FieldDefaultProductFamilies = "defaultProductFamilies"
	FieldStatus                 = "status"
	FieldDeviceCount            = "deviceCount"
	FieldLastConnectedDateTime  = "lastConnectedDateTime"
	FieldLastConnectedIp        = "lastConnectedIp"
	FieldCreatedDateTime        = "createdDateTime"
	FieldUpdatedDateTime        = "updatedDateTime"
	FieldDevices                = "devices"
)

MDM Server field constants for field selection

View Source
const (
	MDMServerStatusActive   = "ACTIVE"
	MDMServerStatusInactive = "INACTIVE"
)

MDM server status constants

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 DeviceManagement added in v0.4.0

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

DeviceManagement 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(c client.Client) *DeviceManagement

NewService creates a new device management service.

func (*DeviceManagement) AssignDevicesV1 added in v0.4.0

func (s *DeviceManagement) AssignDevicesV1(ctx context.Context, mdmServerID string, deviceIDs []string) (*ResponseOrgDeviceActivity, *resty.Response, error)

AssignDevicesV1 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 (*DeviceManagement) CreateMDMServerV1 added in v0.6.0

CreateMDMServerV1 creates a new device management service in an organization. URL: POST https://api-business.apple.com/v1/mdmServers https://developer.apple.com/documentation/applebusinessmanagerapi/create-a-device-management-service Note: serverName and serverCertificate are required.

func (*DeviceManagement) DeleteMDMServerByIDV1 added in v0.6.0

func (s *DeviceManagement) DeleteMDMServerByIDV1(ctx context.Context, serverID string) (*resty.Response, error)

DeleteMDMServerByIDV1 deletes a device management service from an organization. URL: DELETE https://api-business.apple.com/v1/mdmServers/{id} https://developer.apple.com/documentation/applebusinessmanagerapi/delete-a-device-management-service Note: A server with devices assigned cannot be deleted. Returns 204 No Content on success.

func (*DeviceManagement) GetAssignedServerIDByDeviceIDV1 added in v0.4.0

func (s *DeviceManagement) GetAssignedServerIDByDeviceIDV1(ctx context.Context, deviceID string) (*ResponseOrgDeviceAssignedServerLinkage, *resty.Response, error)

GetAssignedServerIDByDeviceIDV1 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 (*DeviceManagement) GetAssignedServerInfoByDeviceIDV1 added in v0.4.0

func (s *DeviceManagement) GetAssignedServerInfoByDeviceIDV1(ctx context.Context, deviceID string, opts *RequestQueryOptions) (*MDMServerResponse, *resty.Response, error)

GetAssignedServerInfoByDeviceIDV1 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 (*DeviceManagement) GetByMDMServerIDV1 added in v0.6.0

func (s *DeviceManagement) GetByMDMServerIDV1(ctx context.Context, serverID string, opts *RequestQueryOptions) (*MDMServerResponse, *resty.Response, error)

GetByMDMServerIDV1 retrieves information about a specific device management service. URL: GET https://api-business.apple.com/v1/mdmServers/{id} https://developer.apple.com/documentation/applebusinessmanagerapi/get-device-management-service-information

func (*DeviceManagement) GetDeviceSerialNumbersByServerIDV1 added in v0.4.0

func (s *DeviceManagement) GetDeviceSerialNumbersByServerIDV1(ctx context.Context, mdmServerID string, opts *RequestQueryOptions) (*ResponseMDMServerDevicesLinkages, *resty.Response, error)

GetDeviceSerialNumbersByServerIDV1 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 (*DeviceManagement) GetV1 added in v0.4.0

GetV1 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 (*DeviceManagement) UnassignDevicesV1 added in v0.4.0

func (s *DeviceManagement) UnassignDevicesV1(ctx context.Context, mdmServerID string, deviceIDs []string) (*ResponseOrgDeviceActivity, *resty.Response, error)

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

func (*DeviceManagement) UpdateMDMServerByIDV1 added in v0.6.0

func (s *DeviceManagement) UpdateMDMServerByIDV1(ctx context.Context, serverID string, req *MDMServerUpdateRequest) (*MDMServerResponse, *resty.Response, error)

UpdateMDMServerByIDV1 updates an existing device management service in an organization. URL: PATCH https://api-business.apple.com/v1/mdmServers/{id} https://developer.apple.com/documentation/applebusinessmanagerapi/update-a-device-management-service

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"`
	EnableMdmDisownFlag    bool       `json:"enableMdmDisownFlag,omitempty"`
	DefaultProductFamilies []string   `json:"defaultProductFamilies,omitempty"`
	Status                 string     `json:"status,omitempty"`
	DeviceCount            int        `json:"deviceCount,omitempty"`
	LastConnectedDateTime  *time.Time `json:"lastConnectedDateTime,omitempty"`
	LastConnectedIp        string     `json:"lastConnectedIp,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 MDMServerCertificate added in v0.6.0

type MDMServerCertificate struct {
	Name string `json:"name"`
	Data string `json:"data"`
}

MDMServerCertificate represents a server certificate for MDM server creation

type MDMServerCreateRequest added in v0.6.0

type MDMServerCreateRequest struct {
	Data MDMServerCreateRequestData `json:"data"`
}

MDMServerCreateRequest is the request body for creating a new MDM server

type MDMServerCreateRequestAttributes added in v0.6.0

type MDMServerCreateRequestAttributes struct {
	ServerName          string               `json:"serverName"`
	ServerCertificate   MDMServerCertificate `json:"serverCertificate"`
	EnableMdmDisownFlag bool                 `json:"enableMdmDisownFlag,omitempty"`
}

MDMServerCreateRequestAttributes contains the attributes for creating an MDM server. ServerName and ServerCertificate are required.

type MDMServerCreateRequestData added in v0.6.0

type MDMServerCreateRequestData struct {
	Type       string                           `json:"type"` // must be "mdmServers"
	Attributes MDMServerCreateRequestAttributes `json:"attributes"`
}

MDMServerCreateRequestData is the data object for an MDM server create request

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 MDMServerUpdateRequest added in v0.6.0

type MDMServerUpdateRequest struct {
	Data MDMServerUpdateRequestData `json:"data"`
}

MDMServerUpdateRequest is the request body for updating an MDM server

type MDMServerUpdateRequestAttributes added in v0.6.0

type MDMServerUpdateRequestAttributes struct {
	ServerName             string   `json:"serverName,omitempty"`
	EnableMdmDisownFlag    *bool    `json:"enableMdmDisownFlag,omitempty"`
	DefaultProductFamilies []string `json:"defaultProductFamilies,omitempty"`
}

MDMServerUpdateRequestAttributes contains the attributes for updating an MDM server. Only provided fields are changed.

type MDMServerUpdateRequestData added in v0.6.0

type MDMServerUpdateRequestData struct {
	Type       string                           `json:"type"` // must be "mdmServers"
	ID         string                           `json:"id"`
	Attributes MDMServerUpdateRequestAttributes `json:"attributes"`
}

MDMServerUpdateRequestData is the data object for an MDM server update request

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