Documentation
¶
Overview ¶
Package device_management is a generated Go SDK for Apple MDM and Declarative Device Management (DDM), built from Apple's canonical schema repo (github.com/apple/device-management).
Typed values go in, spec-validated Apple config comes out:
cmd, _ := mdm.NewCommand(&commands.DeviceLock{PIN: ptr.To("123456")})
prof, _ := mdm.NewProfile("com.example.wifi",
mdm.WithPayload(&profiles.WiFiManaged{...}))
decl, _ := ddm.BuildDeclaration("com.example.passcode",
&configurations.PasscodeSettings{MinimumLength: ptr.To(int64(8))})
The generated packages (mdm/commands, mdm/profiles, ddm/configurations, ddm/assets, ddm/activations, ddm/management) honour Apple's spec: required keys are value fields, optional keys are pointers, and every payload's Validate method enforces allowed values, ranges, formats and nested payload keys. Regeneration is driven by cmd/fetchspec (pinned upstream commit → metadata/specs snapshots) and cmd/gendm (offline codegen); cmd/specdiff renders semantic schema diffs between drops.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
fetchspec
command
Command fetchspec is the acquisition stage of the device-management SDK pipeline.
|
Command fetchspec is the acquisition stage of the device-management SDK pipeline. |
|
gendm
command
Command gendm is the codegen stage of the device-management SDK pipeline: it reads the committed spec snapshots (metadata/specs) and emits the generated payload structs, validation and registries under mdm/ and ddm/.
|
Command gendm is the codegen stage of the device-management SDK pipeline: it reads the committed spec snapshots (metadata/specs) and emits the generated payload structs, validation and registries under mdm/ and ddm/. |
|
specdiff
command
Command specdiff renders a semantic, human-readable markdown report of what changed between two spec snapshot trees — the review surface for Apple's moving schema target.
|
Command specdiff renders a semantic, human-readable markdown report of what changed between two spec snapshot trees — the review surface for Apple's moving schema target. |
|
Package ddm turns validated, generated declaration structs into syntactically correct Declarative Device Management JSON.
|
Package ddm turns validated, generated declaration structs into syntactically correct Declarative Device Management JSON. |
|
internal
|
|
|
codegen
Package codegen orchestrates the offline device-management code generator: it loads the committed spec snapshots, clears previously generated output (identified by the DO-NOT-EDIT header), builds view models (build), renders them through the template firewall (render) and assembles files (fileasm).
|
Package codegen orchestrates the offline device-management code generator: it loads the committed spec snapshots, clears previously generated output (identified by the DO-NOT-EDIT header), builds view models (build), renders them through the template firewall (render) and assembles files (fileasm). |
|
codegen/build
Package build flattens parsed specs into fully-resolved view models.
|
Package build flattens parsed specs into fully-resolved view models. |
|
codegen/fileasm
Package fileasm is the single choke-point for generated-file scaffolding: the DO-NOT-EDIT header, package clause, grouped imports and gofmt.
|
Package fileasm is the single choke-point for generated-file scaffolding: the DO-NOT-EDIT header, package clause, grouped imports and gofmt. |
|
codegen/naming
Package naming holds the spec-to-Go identifier rules shared by every emitter.
|
Package naming holds the spec-to-Go identifier rules shared by every emitter. |
|
codegen/render
Package render is the firewall between view models and Go source: view models go in, source fragments come out, and the only mechanism is text/template execution over the embedded .tmpl files.
|
Package render is the firewall between view models and Go source: view models go in, source fragments come out, and the only mechanism is text/template execution over the embedded .tmpl files. |
|
codegen/view
Package view defines the pure-data models the templates render.
|
Package view defines the pure-data models the templates render. |
|
plistenc
Package plistenc is a deterministic XML property-list encoder for the device-management SDK.
|
Package plistenc is a deterministic XML property-list encoder for the device-management SDK. |
|
spec
Package spec models Apple's device-management schema files (the YAML specs in github.com/apple/device-management) and parses them into the normalized form committed as JSON snapshots under metadata/specs.
|
Package spec models Apple's device-management schema files (the YAML specs in github.com/apple/device-management) and parses them into the normalized form committed as JSON snapshots under metadata/specs. |
|
Package mdm turns validated, generated payload structs into syntactically correct MDM artifacts: command plists and configuration profiles (.mobileconfig).
|
Package mdm turns validated, generated payload structs into syntactically correct MDM artifacts: command plists and configuration profiles (.mobileconfig). |
|
Package ptr provides helpers for the SDK's optional fields.
|
Package ptr provides helpers for the SDK's optional fields. |
|
Package validate implements the value checks Apple's device-management schema declares on payload keys: closed value sets (rangelist), numeric bounds (range), regular-expression formats, array cardinality (repetition) and string subtypes (<url>, <hostname>, <email>).
|
Package validate implements the value checks Apple's device-management schema declares on payload keys: closed value sets (rangelist), numeric bounds (range), regular-expression formats, array cardinality (repetition) and string subtypes (<url>, <hostname>, <email>). |