Documentation
¶
Overview ¶
Package axmassignment persists explicit named-account assignment workflows.
Design ¶
The inventory backend provides atomic documents and shared SQL fencing. Apple calls run outside transactions. A durable submitting marker precedes each POST; an interrupted submission is reconciled using read-only assignment observations and is never automatically resubmitted. Activity IDs and per-device CSV outcomes are distinct from observed assignment convergence. Configuration binds each workflow to one account incarnation, revision, credential, binding generation and MDM service. Revoking authority retains overlap protection for submitted work. Remote attempt deadlines do not cancel worker-lifetime bookkeeping; expired leases still reject all stale commits.
References ¶
https://developer.apple.com/documentation/applebusinessapi/create-an-orgdeviceactivity https://developer.apple.com/documentation/applebusinessapi/get-orgdeviceactivity-information
Index ¶
- type Binding
- type Controller
- func (c *Controller) Binding(ctx context.Context, account string) (Binding, error)
- func (c *Controller) Configure(ctx context.Context, account string, revision int64, service string, ...) (Binding, error)
- func (c *Controller) Evidence(ctx context.Context, account, id string) (Evidence, error)
- func (c *Controller) Get(ctx context.Context, account, id string) (Workflow, error)
- func (c *Controller) Request(ctx context.Context, account, id string, serials []string, now time.Time) (Workflow, error)
- func (c *Controller) RequestUnassign(ctx context.Context, account, id string, serials []string, now time.Time) (Workflow, error)
- func (c *Controller) Run(ctx context.Context) error
- func (c *Controller) Step(ctx context.Context, id string) error
- type Evidence
- type Target
- type Workflow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding struct {
Generation string `json:"generation"`
AccountID string `json:"account_id"`
Revision int64 `json:"account_revision"`
Fingerprint string `json:"fingerprint"`
ServiceID string `json:"service_id"`
Columns axm.ActivityLogColumns `json:"log_columns"`
}
Binding authorizes assignment only to this MDM service using the current account revision.
type Controller ¶
type Controller struct {
Repository *inventory.Repository
Client func(context.Context, inventory.Account, []byte) (*axm.Client, error)
}
Controller uses the application's existing inventory repository and outbound client factory.
func (*Controller) Binding ¶
Binding returns the explicitly configured service, which may need rebinding after rotation.
func (*Controller) Configure ¶
func (c *Controller) Configure(ctx context.Context, account string, revision int64, service string, columns axm.ActivityLogColumns) (Binding, error)
Configure explicitly binds the named account's current revision to this MDM. The service is checked by the worker before mutation; configuration makes no Apple calls.
func (*Controller) Evidence ¶
Evidence returns sensitive retained CSV independently of ordinary workflow reads.
func (*Controller) Request ¶
func (c *Controller) Request(ctx context.Context, account, id string, serials []string, now time.Time) (Workflow, error)
Request persists one explicit assignment. A caller-provided request ID makes retries idempotent. Outstanding overlapping targets are rejected even when the earlier submission is uncertain.
func (*Controller) RequestUnassign ¶
func (c *Controller) RequestUnassign(ctx context.Context, account, id string, serials []string, now time.Time) (Workflow, error)
RequestUnassign removes devices only from the configured service after a checked readback.
type Evidence ¶
type Evidence struct {
CSV []byte `json:"csv"`
Log axm.ActivityLog `json:"log"`
}
Evidence retains exact raw CSV and all parsed fields, including partial failures.
type Target ¶
type Target struct {
Serial string `json:"serial"`
DeviceID string `json:"org_device_id,omitempty"`
Outcome string `json:"outcome,omitempty"`
ObservedService string `json:"observed_service,omitempty"`
ObservedAt *time.Time `json:"observed_at,omitempty"`
Converged bool `json:"converged"`
}
Target retains Apple's addressing identity separately from physical correlation.
type Workflow ¶
type Workflow struct {
Operation string `json:"operation"`
ID string `json:"id"`
Binding Binding `json:"binding"`
State string `json:"state"`
Targets []Target `json:"targets"`
ActivityID string `json:"activity_id,omitempty"`
SubmissionStartedAt *time.Time `json:"submission_started_at,omitempty"`
AcceptedAt *time.Time `json:"accepted_at,omitempty"`
TerminalStatus axm.ActivityStatus `json:"terminal_status,omitempty"`
TerminalSubStatus axm.ActivitySubStatus `json:"terminal_sub_status,omitempty"`
LogComplete bool `json:"log_complete"`
LogSucceeded bool `json:"log_succeeded"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
NextAttempt time.Time `json:"next_attempt"`
// contains filtered or unexported fields
}
Workflow retains intent, acceptance, terminal outcome and independent observations.