Help us shape the future of Go! Take the 2026 Go Developer Survey

inventoryapi

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package inventoryapi defines the v2 resolver protocol independently of Writ and storage implementations. CA projects policy inputs from validated results.

Index

Constants

View Source
const InventoryRelation = "https://epithet.dev/rel/inventory"
View Source
const Version = 2

Version is the inventory resolution wire version.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlRequest added in v0.31.0

type ControlRequest struct {
	Action          string              `json:"action"`
	ID              string              `json:"id,omitempty"`
	Revision        uint64              `json:"revision,omitempty"`
	Host            *inventory.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 {
	CAURL  string                      `json:"ca-url,omitempty"`
	Host   *inventory.HostRecord       `json:"host,omitempty"`
	Hosts  []inventory.HostRecord      `json:"hosts,omitempty"`
	Token  *inventory.EnrollmentToken  `json:"token,omitempty"`
	Tokens []inventory.EnrollmentToken `json:"tokens,omitempty"`
	Audit  []inventory.AuditEvent      `json:"audit,omitempty"`
	Error  string                      `json:"error,omitempty"`
}

type DirectorySnapshot

type DirectorySnapshot struct {
	Revision string      `json:"revision"`
	User     *facts.User `json:"user"`
}

func (*DirectorySnapshot) UnmarshalJSON

func (d *DirectorySnapshot) UnmarshalJSON(data []byte) error

type Host

type Host struct {
	facts.HostResource
	Principal Principal `json:"principal"`
}

func (*Host) UnmarshalJSON added in v0.31.0

func (h *Host) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the complete inventory host, including principal metadata. Using a plain resource prevents promotion of HostResource's custom decoder, which would otherwise consume the enclosing object by itself.

type HostSnapshot

type HostSnapshot struct {
	Revision string `json:"revision"`
	Host     *Host  `json:"host"`
}

func (*HostSnapshot) UnmarshalJSON

func (h *HostSnapshot) UnmarshalJSON(data []byte) error

type Principal

type Principal struct {
	Mode   string `json:"mode"`
	Domain string `json:"domain,omitempty"`
}

type Resolution

type Resolution struct {
	Version        int                  `json:"version"`
	Authentication facts.Authentication `json:"authentication"`
	Target         string               `json:"target"`
	Directory      DirectorySnapshot    `json:"directory"`
	Inventory      HostSnapshot         `json:"inventory"`
}

func (*Resolution) Validate

func (r *Resolution) Validate(host string) error

Validate checks both request binding and all fields whose omission could broaden authorization. Absence of an entity is represented only by null.

type ResolveRequest

type ResolveRequest struct {
	Token string `json:"token"`
	Host  string `json:"host"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL