Documentation
¶
Overview ¶
Package mdm turns validated, generated payload structs into syntactically correct MDM artifacts: command plists and configuration profiles (.mobileconfig). It is the MDM half of the SDK's workflow engine — typed values in, spec-validated Apple config out.
Index ¶
- func NewCommand(payload CommandPayload, opts ...CommandOption) ([]byte, error)
- func NewProfile(identifier string, opts ...ProfileOption) ([]byte, error)
- type CommandOption
- type CommandPayload
- type ProfileOption
- func WithDescription(desc string) ProfileOption
- func WithDisplayName(name string) ProfileOption
- func WithOrganization(org string) ProfileOption
- func WithPayload(p ProfilePayload) ProfileOption
- func WithProfileUUID(uuid string) ProfileOption
- func WithRemovalDisallowed(disallowed bool) ProfileOption
- func WithScope(scope string) ProfileOption
- type ProfilePayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommand ¶
func NewCommand(payload CommandPayload, opts ...CommandOption) ([]byte, error)
NewCommand validates payload and renders the MDM command plist:
{ CommandUUID, Command: { RequestType, …payload keys } }
func NewProfile ¶
func NewProfile(identifier string, opts ...ProfileOption) ([]byte, error)
NewProfile validates every payload and renders a configuration profile (.mobileconfig plist). identifier is the profile's PayloadIdentifier; each payload's PayloadIdentifier and PayloadUUID are derived from it deterministically (identifier.<n>).
Types ¶
type CommandOption ¶
type CommandOption func(*commandConfig)
CommandOption customizes command envelope construction.
func WithCommandUUID ¶
func WithCommandUUID(uuid string) CommandOption
WithCommandUUID sets an explicit CommandUUID. Without it, a deterministic UUID is derived from the command content, so identical commands produce identical plists.
type CommandPayload ¶
type CommandPayload interface {
// RequestType is the command's wire identifier, e.g. "DeviceLock".
RequestType() string
// Validate checks the payload against Apple's spec.
Validate() error
}
CommandPayload is implemented by every generated MDM command struct.
type ProfileOption ¶
type ProfileOption func(*profileConfig)
ProfileOption customizes profile construction.
func WithDescription ¶
func WithDescription(desc string) ProfileOption
WithDescription sets PayloadDescription on the profile.
func WithDisplayName ¶
func WithDisplayName(name string) ProfileOption
WithDisplayName sets PayloadDisplayName on the profile.
func WithOrganization ¶
func WithOrganization(org string) ProfileOption
WithOrganization sets PayloadOrganization on the profile.
func WithPayload ¶
func WithPayload(p ProfilePayload) ProfileOption
WithPayload appends a payload to the profile's PayloadContent.
func WithProfileUUID ¶
func WithProfileUUID(uuid string) ProfileOption
WithProfileUUID sets an explicit PayloadUUID for the profile. Without it, a deterministic UUID is derived from the profile identifier.
func WithRemovalDisallowed ¶
func WithRemovalDisallowed(disallowed bool) ProfileOption
WithRemovalDisallowed sets PayloadRemovalDisallowed.
func WithScope ¶
func WithScope(scope string) ProfileOption
WithScope sets PayloadScope: "System" or "User".
type ProfilePayload ¶
type ProfilePayload interface {
// PayloadType is the payload's wire identifier, e.g. "com.apple.wifi.managed".
PayloadType() string
// Validate checks the payload against Apple's spec.
Validate() error
}
ProfilePayload is implemented by every generated profile payload struct.