Documentation
¶
Index ¶
- func EphemeralProviderRunnerFromConfig[T any](providerFactory ProviderFactory, config EphemeralProviderConfig) func(context.Context, func(context.Context, T) error) error
- func ProviderRunner[T any](providerFactory ProviderFactory, namespace string) func(context.Context) (T, error)
- type EphemeralProvider
- type EphemeralProviderConfig
- type Provider
- type ProviderFactory
- type ProviderGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EphemeralProviderRunnerFromConfig ¶
func EphemeralProviderRunnerFromConfig[T any](providerFactory ProviderFactory, config EphemeralProviderConfig) func(context.Context, func(context.Context, T) error) error
EphemeralProviderRunnerFromConfig returns the ProviderGetter function for a given generic type. This is useful for ad-hoc providers that are not tracked, but instead created and discarded. Credential invalidation is not enforced during the call to the provider. For that reason alone, a closure is returned and the provider is created and discarded on each call.
func ProviderRunner ¶
func ProviderRunner[T any](providerFactory ProviderFactory, namespace string) func(context.Context) (T, error)
ProviderRunner returns the ProviderGetter function for a given generic type. If the returned provider is not of the expected type, a not supported error will be returned.
Types ¶
type EphemeralProvider ¶
EphemeralProvider returns a provider that is not tracked by the worker. It is created and then discarded. No credential invalidation is enforced during the call to the provider.
type EphemeralProviderConfig ¶
type EphemeralProviderConfig struct { // ModelType is the type of the model. ModelType model.ModelType // ModelConfig is the model configuration for the provider. ModelConfig *config.Config // CloudSpec is the cloud spec for the provider. CloudSpec cloudspec.CloudSpec // ControllerUUID is the UUID of the controller that the provider is // associated with. This is currently only used for k8s providers. ControllerUUID uuid.UUID }
EphemeralProviderConfig is a struct that contains the necessary information to create a provider.
type Provider ¶
type Provider interface { // InstancePrechecker provides a means of "prechecking" placement // arguments before recording them in state. environs.InstancePrechecker // BootstrapEnviron defines methods for bootstrapping a controller. environs.BootstrapEnviron // ResourceAdopter defines methods for adopting resources. environs.ResourceAdopter }
Provider in the intersection of a environs.Environ and a caas.Broker.
We ideally don't want to import the environs package here, but I've not sure how to avoid it.
type ProviderFactory ¶
type ProviderFactory interface { // ProviderForModel returns the encapsulated provider for a given model // namespace. It will continue to be updated in the background for as long // as the Worker continues to run. If the worker is not a singular worker, // then an error will be returned. ProviderForModel(ctx context.Context, namespace string) (Provider, error) // EphemeralProviderFromConfig returns an ephemeral provider for a given // configuration. The provider is not tracked, instead is created and then // discarded. EphemeralProviderFromConfig(ctx context.Context, config EphemeralProviderConfig) (Provider, error) }
ProviderFactory is an interface that provides a way to get a provider for a given model namespace. It will continue to be updated in the background for as long as the Worker continues to run.