idname

package
v0.0.0-...-880cb89 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCache

func NewCache(idToName map[string]string) *cache

func NewProvider

func NewProvider(id, name string) *is

Types

type CacheBuilder

type CacheBuilder interface {
	Add(id, name string)
	Cacher
}

type Cacher

type Cacher interface {
	IDOf(name string) (string, bool)
	NameOf(id string) (string, bool)
	IDs() []string
	Names() []string
	ProviderForID(id string) Provider
	ProviderForName(id string) Provider
}

type GetResourceIDAndNamer

type GetResourceIDAndNamer interface {
	GetResourceIDAndNameFrom(
		ctx context.Context,
		owner string,
		cacher Cacher,
	) (Provider, error)
}

type Provider

type Provider interface {
	// ID returns the canonical id of the thing, generated and
	// usable  by whichever system has ownership of it.
	ID() string
	// the human-readable name of the thing.
	Name() string
}

Provider is a tuple containing an ID and a Name. Names are assumed to be human-displayable versions of system IDs. Providers should always be populated, while a nil values is likely an error. Compliant structs should provide both a name and an ID, never just one. Values are not validated, so both values being empty is an allowed conditions, but the assumption is that downstream consumers will have problems as a result.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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