Documentation
¶
Overview ¶
Package ddm turns validated, generated declaration structs into syntactically correct Declarative Device Management JSON. It is the DDM half of the SDK's workflow engine — typed values in, spec-validated declarations out.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDeclaration ¶
func BuildDeclaration(identifier string, payload DeclarationPayload, opts ...DeclarationOption) ([]byte, error)
BuildDeclaration is the one-call form: validate, wrap and render JSON.
Types ¶
type Declaration ¶
type Declaration struct {
Type string `json:"Type"`
Identifier string `json:"Identifier"`
ServerToken string `json:"ServerToken,omitempty"`
Payload any `json:"Payload"`
}
Declaration is the DDM envelope: what a declarations endpoint serves.
func NewDeclaration ¶
func NewDeclaration(identifier string, payload DeclarationPayload, opts ...DeclarationOption) (*Declaration, error)
NewDeclaration validates payload and builds the declaration envelope.
func (*Declaration) JSON ¶
func (d *Declaration) JSON() ([]byte, error)
JSON renders the declaration as indented DDM JSON.
type DeclarationOption ¶
type DeclarationOption func(*Declaration)
DeclarationOption customizes declaration construction.
func WithServerToken ¶
func WithServerToken(token string) DeclarationOption
WithServerToken sets the declaration's ServerToken, used by clients to detect changed declarations.
type DeclarationPayload ¶
type DeclarationPayload interface {
// DeclarationType is the declaration's wire identifier,
// e.g. "com.apple.configuration.passcode.settings".
DeclarationType() string
// Validate checks the payload against Apple's spec.
Validate() error
}
DeclarationPayload is implemented by every generated declaration struct (configurations, assets, activations, management).