resolver

package
v3.28.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmbiguousResolutionError

type AmbiguousResolutionError string

AmbiguousResolutionError is a resolver error when multiple matching entries have been found.

func (AmbiguousResolutionError) Error

func (s AmbiguousResolutionError) Error() string

type Cache added in v3.18.0

type Cache[T any] struct {
	// contains filtered or unexported fields
}

func (*Cache[T]) AddCached added in v3.18.0

func (c *Cache[T]) AddCached(uuid string, val T)

func (*Cache[T]) GetCached added in v3.18.0

func (c *Cache[T]) GetCached(uuid string) (T, error)

type CacheUninitializedError added in v3.18.0

type CacheUninitializedError string

func (CacheUninitializedError) Error added in v3.18.0

func (s CacheUninitializedError) Error() string

type CachingAccount added in v3.4.0

type CachingAccount struct{}

CachingAccount implements resolver for servers, caching the results

func (CachingAccount) Get added in v3.4.0

Get implements ResolutionProvider.Get

func (CachingAccount) PositionalArgumentHelp added in v3.4.0

func (s CachingAccount) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingDatabase

type CachingDatabase struct {
	Cache[upcloud.ManagedDatabase]
}

CachingDatabase implements resolver for servers, caching the results

func (*CachingDatabase) Get

Get implements ResolutionProvider.Get

func (CachingDatabase) PositionalArgumentHelp

func (s CachingDatabase) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingGateway added in v3.4.0

type CachingGateway struct{}

CachingGatewayimplements resolver for gateways, caching the results

func (CachingGateway) Get added in v3.4.0

Get implements ResolutionProvider.Get

func (CachingGateway) PositionalArgumentHelp added in v3.4.0

func (s CachingGateway) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingIPAddress

type CachingIPAddress struct{}

CachingIPAddress implements resolver for ip addresses that resolve with ptr records, caching the results

func (CachingIPAddress) Get

Get implements ResolutionProvider.Get

func (CachingIPAddress) PositionalArgumentHelp

func (s CachingIPAddress) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingKubernetes

type CachingKubernetes struct {
	Cache[upcloud.KubernetesCluster]
}

CachingKubernetes implements resolver for Kubernetes clusters, caching the results

func (*CachingKubernetes) Get

Get implements ResolutionProvider.Get

func (CachingKubernetes) PositionalArgumentHelp

func (s CachingKubernetes) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingLoadBalancer

type CachingLoadBalancer struct {
	Cache[upcloud.LoadBalancer]
}

CachingLoadBalancer implements resolver for servers, caching the results

func (*CachingLoadBalancer) Get

Get implements ResolutionProvider.Get

func (CachingLoadBalancer) PositionalArgumentHelp

func (s CachingLoadBalancer) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingNetwork

type CachingNetwork struct {
	Cache[upcloud.Network]
}

CachingNetwork implements resolver for networks, caching the results

func (*CachingNetwork) Get

Get implements ResolutionProvider.Get

func (*CachingNetwork) PositionalArgumentHelp

func (s *CachingNetwork) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingNetworkPeering added in v3.6.0

type CachingNetworkPeering struct {
	Cache[upcloud.NetworkPeering]
}

CachingNetworkPeering resolver for network peerings, caching the results

func (*CachingNetworkPeering) Get added in v3.6.0

Get implements ResolutionProvider.Get

func (CachingNetworkPeering) PositionalArgumentHelp added in v3.6.0

func (s CachingNetworkPeering) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingObjectStorage added in v3.7.0

type CachingObjectStorage struct {
	Cache[upcloud.ManagedObjectStorage]
}

CachingObjectStorage implements resolver for ObjectStorages, caching the results

func (*CachingObjectStorage) Get added in v3.7.0

Get implements ResolutionProvider.Get

func (CachingObjectStorage) PositionalArgumentHelp added in v3.7.0

func (s CachingObjectStorage) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingResolutionProvider added in v3.18.0

type CachingResolutionProvider[T any] interface {
	ResolutionProvider
	GetCached(uuid string) (T, error)
}

type CachingRouter

type CachingRouter struct {
	Cache[upcloud.Router]

	Type string
}

CachingRouter implements resolver for routers by uuid or name, caching the results

func (*CachingRouter) Get

Get implements ResolutionProvider.Get

func (*CachingRouter) PositionalArgumentHelp

func (s *CachingRouter) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingServer

type CachingServer struct {
	Cache[upcloud.Server]
}

CachingServer implements resolver for servers, caching the results

func (*CachingServer) Get

Get implements ResolutionProvider.Get

func (CachingServer) PositionalArgumentHelp

func (s CachingServer) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingServerGroup

type CachingServerGroup struct {
	Cache[upcloud.ServerGroup]
}

CachingServerGroup implements resolver for servers, caching the results

func (*CachingServerGroup) Get

Get implements ResolutionProvider.Get

func (CachingServerGroup) PositionalArgumentHelp

func (s CachingServerGroup) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingStorage

type CachingStorage struct {
	Cache[upcloud.Storage]

	Access string
}

CachingStorage implements resolver for storages, caching the results

func (*CachingStorage) Get

Get implements ResolutionProvider.Get

func (*CachingStorage) PositionalArgumentHelp

func (s *CachingStorage) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type CachingToken added in v3.15.0

type CachingToken struct{}

CachingToken implements resolver for tokens, caching the results.

func (CachingToken) Get added in v3.15.0

Get implements ResolutionProvider.Get

func (CachingToken) PositionalArgumentHelp added in v3.15.0

func (s CachingToken) PositionalArgumentHelp() string

PositionalArgumentHelp implements resolver.ResolutionProvider

type MatchType added in v3.12.0

type MatchType int
const (
	MatchTypeExact           MatchType = 4
	MatchTypeCaseInsensitive MatchType = 3
	MatchTypeGlobPattern     MatchType = 2
	MatchTypePrefix          MatchType = 1
	MatchTypeNone            MatchType = 0
)

func MatchArgWithEqualFold added in v3.22.0

func MatchArgWithEqualFold(arg, value string) MatchType

MatchArgWithEqualFold checks if arg is a exact or case-insensitive match.

func MatchArgWithGlobPattern added in v3.14.0

func MatchArgWithGlobPattern(arg, value string) MatchType

MatchArgWithGlobPattern checks if arg matches given value as a unix style glob pattern.

func MatchTitle added in v3.14.0

func MatchTitle(arg string, values ...string) MatchType

MatchTitle checks if arg matches any of the given values by using MatchArgWithEqualFold and MatchArgWithGlobPattern matchers.

func MatchUUID added in v3.12.0

func MatchUUID(arg, value string) MatchType

type NonGlobMultipleMatchesError added in v3.14.0

type NonGlobMultipleMatchesError string

NonGlobMultipleMatchesError is a resolver error when multiple matching entries have been found with non-glob argument.

func (NonGlobMultipleMatchesError) Error added in v3.14.0

type NotFoundError

type NotFoundError string

NotFoundError is a resolver error when no matching entries have been found.

func (NotFoundError) Error

func (s NotFoundError) Error() string

type ResolutionProvider

type ResolutionProvider interface {
	Get(ctx context.Context, svc service.AllServices) (Resolver, error)
	PositionalArgumentHelp() string
}

ResolutionProvider is an interface for commands that provide resolution, either custom or the built-in ones

type Resolved added in v3.12.0

type Resolved struct {
	Arg string
	// contains filtered or unexported fields
}

func (*Resolved) AddMatch added in v3.12.0

func (r *Resolved) AddMatch(uuid string, matchType MatchType)

AddMatch adds a match to the resolved value. If the match is already present, the highest match type is kept. I.e., exact match is kept over case insensitive match.

func (*Resolved) GetAll added in v3.12.0

func (r *Resolved) GetAll() ([]string, error)

GetAll returns matches with match-type that equals the highest available match-type for the resolved value. I.e., if there is an exact match, only exact matches are returned even if there would be case-insensitive matches.

If match-type is not a glob pattern match, an error is returned if there are multiple matches.

func (*Resolved) GetOnly added in v3.12.0

func (r *Resolved) GetOnly() (string, error)

GetOnly returns the only match if there is only one match. If there are no or multiple matches, an empty value and an error is returned.

type Resolver

type Resolver func(arg string) (resolved Resolved)

Resolver represents the most basic argument resolver, a function that accepts and argument and returns the resolved value(s).

Jump to

Keyboard shortcuts

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