Documentation
¶
Overview ¶
Package support answers "is this key supported on this OS, version, channel, and enrollment context?" at runtime, from tables generated out of the supportedOS blocks in Apple's device management schema.
Why ¶
Apple's YAML records, per key, the OS version that introduced it, deprecated it, or removed it, whether it needs supervision, and whether it is allowed on user enrollment, Shared iPad, or the user channel. Most implementations drop that data at generation time; decision record 0003 keeps it, so a server can refuse to send a key the target device will reject and an operator tool can explain a command. Generated packages register their tables in init; callers query them through Lookup or, indirectly, through the generated Validate methods when given a Target. Phase 1 of the plan of record delivers the tables with the schema packages, and phase 8's mdmctl explain reads them.
The package holds the query logic and the types; the tables themselves are generated and never hand-edited.
References ¶
- Decision record 0003: docs/research/decisions/0003-schema-generator.md
- Plan of record: docs/research/implementation_plan.md (section 2, the generator; phase 1)
- Apple: https://github.com/apple/device-management/blob/release/docs/schema.md
- Apple: https://developer.apple.com/documentation/devicemanagement
- Schema: third_party/device-management/docs/schema.yaml (supportedOS)
Index ¶
Constants ¶
This section is empty.
Variables ¶
AllOS lists the operating systems in schema order.
var ErrVersion = errors.New("support: malformed version")
ErrVersion is returned by ParseVersion for malformed input.
Functions ¶
Types ¶
type Entry ¶
Entry is the support table row for one schema key path.
type Mode ¶
type Mode string
Mode is Apple's allowed/required/forbidden/ignored setting for shared iPad and user enrollment contexts. Empty means unspecified (allowed).
type OS ¶
type OS string
OS names as used in Apple's schema.
const ( IOS OS = "iOS" MacOS OS = "macOS" TvOS OS = "tvOS" VisionOS OS = "visionOS" WatchOS OS = "watchOS" )
Operating systems.
func OSFromProduct ¶
OSFromProduct maps a device product type (Authenticate's ProductName or MachineInfo's PRODUCT, for example "iPhone17,2", "Mac16,1", "iPad14,1", "AppleTV14,1", "RealityDevice14,1", "Watch7,1") to the OS family Apple's schema keys support on. iPadOS is keyed as iOS in the schema. Unknown prefixes return "".
type OSSupport ¶
type OSSupport struct {
// NotAvailable is set when Apple lists "introduced: n/a".
NotAvailable bool
Introduced Version
Deprecated Version
Removed Version
AccessRights string
Beta bool
// Tri-state booleans: nil means Apple did not say.
Multiple *bool
DeviceChannel *bool
UserChannel *bool
Supervised *bool
RequiresDEP *bool
UserApprovedMDM *bool
AllowManualInstall *bool
AlwaysSkippable *bool
AllowedEnrollments []string
AllowedScopes []string
UserEnrollmentMode Mode
UserEnrollmentBehavior string
}
OSSupport is the effective support block for one key on one OS after inheritance from the enclosing payload and parent keys.
type Target ¶
type Target struct {
OS OS
Version Version
Channel Channel
Supervised bool
UserEnrollment bool
DEP bool
UserApproved bool
}
Target describes the device a value is destined for. The zero Target disables every context check.
type Version ¶
type Version struct {
Major, Minor, Patch int
}
Version is a dotted OS version. The zero Version means "unspecified".
func MustVersion ¶
MustVersion parses or panics; for generated tables and tests.
func ParseVersion ¶
ParseVersion parses "26", "26.4", or "10.15.4".