Documentation
¶
Overview ¶
Package inventoryapi defines the inventory and directory administration control API: the JSON operations an administrator or enrolling host sends to the advertised inventory endpoint, and the records it returns. The types here are the wire schema only; storage packages convert to and from them at the service boundary and never share their persisted shapes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindingSnapshot ¶ added in v0.35.0
type BindingSnapshot struct {
Revision uint64 `json:"revision"`
Groups []GroupBinding `json:"groups"`
}
BindingSnapshot lets administrators bind a review to the exact directory revision they inspected. Deleted bindings retain the former group ID.
type Capabilities ¶ added in v0.35.0
type Capabilities struct {
Version int `json:"version"`
Capabilities []string `json:"capabilities"`
}
Capabilities distinguishes host enrollment from directory-only administration. An unavailable or malformed endpoint is an error, never static fallback.
type ControlRequest ¶ added in v0.31.0
type ControlRequest struct {
AuditAfter uint64 `json:"audit-after,omitempty"`
AuditLimit int `json:"audit-limit,omitempty"`
Alias string `json:"alias,omitempty"`
Action string `json:"action"`
ID string `json:"id,omitempty"`
Revision uint64 `json:"revision,omitempty"`
Host *Proposal `json:"host,omitempty"`
Token string `json:"token,omitempty"`
LifetimeSeconds int64 `json:"lifetime-seconds,omitempty"`
}
ControlRequest is one operation at the complete advertised inventory URL. An optional single-use token preapproves enrollment. Admin authentication is the OIDC bearer header. Revision binds review/edit to the displayed record.
type ControlResponse ¶ added in v0.31.0
type ControlResponse struct {
DirectoryUsers *UserSnapshot `json:"directory-users,omitempty"`
Directory *BindingSnapshot `json:"directory,omitempty"`
DirectoryAudit []DirectoryAuditEvent `json:"directory-audit,omitempty"`
Host *HostRecord `json:"host,omitempty"`
Hosts []HostRecord `json:"hosts,omitempty"`
Token *EnrollmentToken `json:"token,omitempty"`
Tokens []EnrollmentToken `json:"tokens,omitempty"`
Audit []HostAuditEvent `json:"audit,omitempty"`
Error string `json:"error,omitempty"`
}
ControlResponse carries the result of one ControlRequest. Only the fields relevant to the requested action are set; Error accompanies a non-2xx status.
type DirectoryAuditEvent ¶ added in v0.35.0
type DirectoryAuditEvent struct {
Sequence uint64 `json:"sequence"`
Revision uint64 `json:"revision"`
Time time.Time `json:"time"`
Actor string `json:"actor"`
Action string `json:"action"`
ID string `json:"id"`
Alias string `json:"alias,omitempty"`
PreviousID string `json:"previous-id,omitempty"`
}
DirectoryAuditEvent records one directory mutation. Sequence identifies the event independently of directory revisions: several events can belong to the same mutation, and zero starts a cursor at the beginning.
type DirectoryUser ¶ added in v0.36.0
type EnrollmentToken ¶ added in v0.35.0
type EnrollmentToken struct {
ID string `json:"id"`
ExpiresAt time.Time `json:"expires-at"`
UsedBy string `json:"used-by,omitempty"`
Revoked bool `json:"revoked"`
}
EnrollmentToken is a single-use preapproval for host enrollment.
type GroupBinding ¶ added in v0.35.0
type GroupBinding struct {
ID string `json:"id"`
DisplayName string `json:"displayName"`
Alias string `json:"alias,omitempty"`
Status string `json:"status"`
}
GroupBinding is one provisioned directory group and its policy alias.
type HostAuditEvent ¶ added in v0.35.0
type HostAuditEvent struct {
At time.Time `json:"at"`
Actor string `json:"actor"`
Action string `json:"action"`
Resource string `json:"resource"`
}
HostAuditEvent records one administrative change to host inventory.
type HostRecord ¶ added in v0.35.0
type HostRecord struct {
SourceFile string `json:"source-file,omitempty"`
Pattern string `json:"pattern,omitempty"`
ID string `json:"id"`
Revision uint64 `json:"revision"`
Status string `json:"status"`
Proposal Proposal `json:"host"`
CreatedAt time.Time `json:"created-at"`
UpdatedAt time.Time `json:"updated-at"`
Source string `json:"source,omitempty"`
ShadowedNames []string `json:"shadowed-names,omitempty"`
}
HostRecord is one inventory host as administrators see it. Source metadata is present only for records the server can attribute to a file or pattern.
type Proposal ¶ added in v0.35.0
type Proposal struct {
Names []string `json:"names"`
Labels map[string]string `json:"labels"`
Accounts []string `json:"accounts"`
PrincipalMode string `json:"principal-mode"`
Domain string `json:"domain,omitempty"`
}
Proposal is the entire editable authorization record for one host. Admission and ownership are server-owned metadata, never fields a host can approve for itself. Accounts nil means unrestricted; an empty list permits no accounts.
func (*Proposal) UnmarshalJSON ¶ added in v0.35.0
UnmarshalJSON requires accounts at the input boundary. Explicit null is unrestricted; [] permits none. Accidentally omitting the field must not broaden access, so omission is an error rather than a default.
type UserSnapshot ¶ added in v0.36.0
type UserSnapshot struct {
Revision string `json:"revision"`
Users []DirectoryUser `json:"users"`
}
UserSnapshot is the selected directory's authorization view. IDs identify users to OIDC and policy; groups are policy names, not SCIM resource IDs.