registry

package
v1.234.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasIdentity

func HasIdentity(kind string) bool

HasIdentity reports whether the process registry can construct this identity kind.

func HasProvider

func HasProvider(kind string) bool

HasProvider reports whether the process registry can construct this provider kind.

func NewIdentity

func NewIdentity(name string, config *schema.Identity) (types.Identity, error)

NewIdentity creates an identity through the process-wide registry.

func NewProvider

func NewProvider(name string, config *schema.Provider) (types.Provider, error)

NewProvider creates a provider through the process-wide registry.

func RegisterBatch

func RegisterBatch(batch Registration) (func(), error)

RegisterBatch installs a package's constructors in the process-wide registry.

func RegisterEmulatorIdentities

func RegisterEmulatorIdentities(f *Registry) error

RegisterEmulatorIdentities registers all emulator-bound identity constructors with the registry. A single Identity type backs every emulator kind; the kind is carried on the config (set via the registry's ConfigSetter path after construction).

func RegisterGCPIdentities

func RegisterGCPIdentities(f *Registry) error

RegisterGCPIdentities registers all GCP identity constructors with the registry.

func RegisterGCPProviders

func RegisterGCPProviders(f *Registry) error

RegisterGCPProviders registers all GCP provider constructors with the registry.

func RegisterIdentity

func RegisterIdentity(kind string, constructor IdentityConfigConstructor) error

RegisterIdentity registers an identity in the process-wide auth registry.

func RegisterProvider

func RegisterProvider(kind string, constructor ProviderConfigConstructor) error

RegisterProvider registers a provider in the process-wide auth registry.

Types

type ConfigSetter

type ConfigSetter interface{ SetConfig(config *schema.Identity) }

ConfigSetter is an optional interface for identities that need access to the full config. Used by GCP identities to access Via.Provider for whoami reporting.

type IdentityConfigConstructor

type IdentityConfigConstructor func(name string, config *schema.Identity) (types.Identity, error)

IdentityConfigConstructor receives the entire identity configuration.

type IdentityConstructor

type IdentityConstructor func(name string, principal map[string]any) (types.Identity, error)

IdentityConstructor creates an identity from name and principal.

type ProviderConfigConstructor

type ProviderConfigConstructor func(name string, config *schema.Provider) (types.Provider, error)

ProviderConfigConstructor receives the entire provider configuration.

type ProviderConstructor

type ProviderConstructor func(name string, spec map[string]any) (types.Provider, error)

ProviderConstructor creates a provider from name and spec.

type Registration

type Registration struct {
	Providers  map[string]ProviderConfigConstructor
	Identities map[string]IdentityConfigConstructor
}

Registration groups constructors that must become visible atomically.

type Registry

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

Registry manages provider and identity registration. Constructors run outside the lock.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a registry containing every built-in provider and identity.

func (*Registry) CreateIdentity

func (f *Registry) CreateIdentity(kind, name string, principal map[string]any) (types.Identity, error)

CreateIdentity creates an identity using its principal.

func (*Registry) CreateProvider

func (f *Registry) CreateProvider(kind, name string, spec map[string]any) (types.Provider, error)

CreateProvider creates a provider using its spec.

func (*Registry) HasIdentity

func (f *Registry) HasIdentity(kind string) bool

HasIdentity checks if an identity kind is registered.

func (*Registry) HasProvider

func (f *Registry) HasProvider(kind string) bool

HasProvider checks if a provider kind is registered.

func (*Registry) NewIdentity

func (f *Registry) NewIdentity(name string, config *schema.Identity) (types.Identity, error)

NewIdentity creates an identity without discarding its chain, session, or credentials.

func (*Registry) NewProvider

func (f *Registry) NewProvider(name string, config *schema.Provider) (types.Provider, error)

NewProvider creates a provider without discarding legacy configuration fields.

func (*Registry) RegisterBatch

func (f *Registry) RegisterBatch(batch Registration) (func(), error)

RegisterBatch validates every name before changing the registry. The returned cleanup removes only this batch and can safely be called more than once.

func (*Registry) RegisterIdentity

func (f *Registry) RegisterIdentity(kind string, constructor IdentityConstructor) error

RegisterIdentity registers a principal-based constructor without replacing an existing kind.

func (*Registry) RegisterIdentityConfig

func (f *Registry) RegisterIdentityConfig(kind string, constructor IdentityConfigConstructor) error

RegisterIdentityConfig registers a constructor with access to the entire configuration.

func (*Registry) RegisterProvider

func (f *Registry) RegisterProvider(kind string, constructor ProviderConstructor) error

RegisterProvider registers a spec-based constructor without replacing an existing kind.

func (*Registry) RegisterProviderConfig

func (f *Registry) RegisterProviderConfig(kind string, constructor ProviderConfigConstructor) error

RegisterProviderConfig registers a constructor with access to the entire configuration.

Jump to

Keyboard shortcuts

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