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

protect

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound reports that a lookup completed and the name was absent — as distinct from the lookup itself failing.

Callers that create-on-absent must tell the two apart with errors.Is. Treating every error as "absent" turns a transient list failure, an expired token or a permission problem into an unintended create, and the operator sees whatever the server says about the resulting duplicate rather than the real cause. That matters most in bulk paths like 'protect restore', where one blip mid-run would otherwise mutate the tenant a different way than intended.

Functions

func DescribeComputer added in v1.32.0

func DescribeComputer(c jamfprotect.Computer) string

DescribeComputer renders a computer as hostname, serial and UUID for confirmations and ambiguity refusals.

func PickNamed added in v1.32.0

func PickNamed(refs []NamedRef, name, noun, listCmd, avail string) (string, error)

PickNamed returns the id of the one ref named exactly name. A name no ref carries matches ErrNotFound; a name several refs share is refused with every id, since acting on one of them would be a guess.

func PrintList

func PrintList[T any](out registry.OutputFormatter, items []T) error

PrintList outputs a list of items through the CLI formatter.

func PrintOne

func PrintOne[T any](out registry.OutputFormatter, item T) error

PrintOne outputs a single item through the CLI formatter.

Types

type NamedRef added in v1.32.0

type NamedRef struct {
	Name string
	ID   string
}

NamedRef is one listed record reduced to the name it is looked up by and the identifier the caller acts on.

func RefsOf added in v1.32.0

func RefsOf[T any](items []T, name, id func(T) string) []NamedRef

RefsOf reduces a listing to NamedRefs.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver maps resource names to IDs/UUIDs. Results are cached per resource type to avoid redundant list calls within a single command.

func NewResolver

func NewResolver(client registry.ProtectClient) *Resolver

NewResolver creates a Resolver for the given Protect client.

func (*Resolver) ResolveActionConfigID

func (r *Resolver) ResolveActionConfigID(ctx context.Context, name string) (string, error)

ResolveActionConfigID returns the ID for an action config given its name.

func (*Resolver) ResolveAnalyticSetUUID

func (r *Resolver) ResolveAnalyticSetUUID(ctx context.Context, name string) (string, error)

ResolveAnalyticSetUUID returns the UUID for an analytic set given its name.

func (*Resolver) ResolveAnalyticUUID

func (r *Resolver) ResolveAnalyticUUID(ctx context.Context, name string) (string, error)

ResolveAnalyticUUID returns the UUID for an analytic given its name.

func (*Resolver) ResolveApiClientID

func (r *Resolver) ResolveApiClientID(ctx context.Context, name string) (string, error)

ResolveApiClientID returns the client ID for an API client given its name.

func (*Resolver) ResolveComputer added in v1.32.0

func (r *Resolver) ResolveComputer(ctx context.Context, arg string) (jamfprotect.Computer, error)

ResolveComputer returns the one computer identified by arg, matched as an exact UUID, then serial number, then hostname. The first identifier that matches decides, so a hostname set to another computer's serial cannot capture it, and two computers sharing the deciding value are refused.

func (*Resolver) ResolveComputerUUID

func (r *Resolver) ResolveComputerUUID(ctx context.Context, arg string) (string, error)

ResolveComputerUUID returns the UUID of the computer ResolveComputer picks.

func (*Resolver) ResolveConnectionID added in v1.28.0

func (r *Resolver) ResolveConnectionID(ctx context.Context, name string) (string, error)

ResolveConnectionID returns the ID for an identity provider connection given its name.

func (*Resolver) ResolveCustomPreventListID

func (r *Resolver) ResolveCustomPreventListID(ctx context.Context, name string) (string, error)

ResolveCustomPreventListID returns the ID for a custom prevent list given its name.

func (*Resolver) ResolveExceptionSetUUID

func (r *Resolver) ResolveExceptionSetUUID(ctx context.Context, name string) (string, error)

ResolveExceptionSetUUID returns the UUID for an exception set given its name.

func (*Resolver) ResolveGroupID

func (r *Resolver) ResolveGroupID(ctx context.Context, name string) (string, error)

ResolveGroupID returns the ID for a group given its name.

func (*Resolver) ResolveInsightUUID

func (r *Resolver) ResolveInsightUUID(ctx context.Context, label string) (string, error)

ResolveInsightUUID returns the UUID for an insight given its label.

func (*Resolver) ResolvePlanID

func (r *Resolver) ResolvePlanID(ctx context.Context, name string) (string, error)

ResolvePlanID returns the ID for a plan given its name.

func (*Resolver) ResolveRemovableStorageControlSetID

func (r *Resolver) ResolveRemovableStorageControlSetID(ctx context.Context, name string) (string, error)

ResolveRemovableStorageControlSetID returns the ID for a removable storage control set.

func (*Resolver) ResolveRoleID

func (r *Resolver) ResolveRoleID(ctx context.Context, name string) (string, error)

ResolveRoleID returns the ID for a role given its name.

func (*Resolver) ResolveTelemetryV2ID

func (r *Resolver) ResolveTelemetryV2ID(ctx context.Context, name string) (string, error)

ResolveTelemetryV2ID returns the ID for a telemetry v2 config given its name.

func (*Resolver) ResolveUnifiedLoggingFilterSetUUID added in v1.27.0

func (r *Resolver) ResolveUnifiedLoggingFilterSetUUID(ctx context.Context, name string) (string, error)

ResolveUnifiedLoggingFilterSetUUID returns the UUID for a unified logging filter set.

func (*Resolver) ResolveUnifiedLoggingFilterUUID

func (r *Resolver) ResolveUnifiedLoggingFilterUUID(ctx context.Context, name string) (string, error)

ResolveUnifiedLoggingFilterUUID returns the UUID for a unified logging filter.

func (*Resolver) ResolveUserID

func (r *Resolver) ResolveUserID(ctx context.Context, email string) (string, error)

ResolveUserID returns the ID for a user given their email.

Jump to

Keyboard shortcuts

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