Documentation ¶
Overview ¶
Package providers contains the logic for managing provider resources (versioning, loading, resource operations).
Index ¶
- Constants
- func GetProviderPackage(typ tokens.Type) tokens.Package
- func GetProviderVersion(inputs resource.PropertyMap) (*semver.Version, error)
- func IsDefaultProvider(urn resource.URN) bool
- func IsProviderType(typ tokens.Type) bool
- func MakeProviderType(pkg tokens.Package) tokens.Type
- type ProviderRequest
- type Reference
- type Registry
- func (r *Registry) Check(urn resource.URN, olds, news resource.PropertyMap, allowUnknowns bool) (resource.PropertyMap, []plugin.CheckFailure, error)
- func (r *Registry) CheckConfig(urn resource.URN, olds, news resource.PropertyMap, allowUnknowns bool) (resource.PropertyMap, []plugin.CheckFailure, error)
- func (r *Registry) Close() error
- func (r *Registry) Configure(props resource.PropertyMap) error
- func (r *Registry) Construct(info plugin.ConstructInfo, typ tokens.Type, name tokens.QName, ...) (plugin.ConstructResult, error)
- func (r *Registry) Create(urn resource.URN, news resource.PropertyMap, timeout float64, preview bool) (resource.ID, resource.PropertyMap, resource.Status, error)
- func (r *Registry) Delete(urn resource.URN, id resource.ID, props resource.PropertyMap, timeout float64) (resource.Status, error)
- func (r *Registry) Diff(urn resource.URN, id resource.ID, olds, news resource.PropertyMap, ...) (plugin.DiffResult, error)
- func (r *Registry) DiffConfig(urn resource.URN, olds, news resource.PropertyMap, allowUnknowns bool, ...) (plugin.DiffResult, error)
- func (r *Registry) GetPluginInfo() (workspace.PluginInfo, error)
- func (r *Registry) GetProvider(ref Reference) (plugin.Provider, bool)
- func (r *Registry) GetSchema(version int) ([]byte, error)
- func (r *Registry) Invoke(tok tokens.ModuleMember, args resource.PropertyMap) (resource.PropertyMap, []plugin.CheckFailure, error)
- func (r *Registry) Pkg() tokens.Package
- func (r *Registry) Read(urn resource.URN, id resource.ID, inputs, state resource.PropertyMap) (plugin.ReadResult, resource.Status, error)
- func (r *Registry) SignalCancellation() error
- func (r *Registry) StreamInvoke(tok tokens.ModuleMember, args resource.PropertyMap, ...) ([]plugin.CheckFailure, error)
- func (r *Registry) Update(urn resource.URN, id resource.ID, olds, news resource.PropertyMap, ...) (resource.PropertyMap, resource.Status, error)
Constants ¶
const UnknownID = plugin.UnknownStringValue
UnknownID is a distinguished token used to indicate that a provider's ID is not known (e.g. because we are performing a preview).
Variables ¶
This section is empty.
Functions ¶
func GetProviderPackage ¶
GetProviderPackage returns the provider package for the given type token.
func GetProviderVersion ¶
func GetProviderVersion(inputs resource.PropertyMap) (*semver.Version, error)
GetProviderVersion fetches and parses a provider version from the given property map. If the version property is not present, this function returns nil.
func IsDefaultProvider ¶
IsDefaultProvider returns true if this URN refers to a default Pulumi provider.
func IsProviderType ¶
IsProviderType returns true if the supplied type token refers to a Pulumi provider.
Types ¶
type ProviderRequest ¶
type ProviderRequest struct {
// contains filtered or unexported fields
}
A ProviderRequest is a tuple of an optional semantic version and a package name. Whenever the engine receives a registration for a resource that doesn't explicitly specify a provider, the engine creates a ProviderRequest for that resource's provider, using the version passed to the engine as part of RegisterResource and the package derived from the resource's token.
The source evaluator (source_eval.go) is responsible for servicing provider requests. It does this by interpreting these provider requests and sending resource registrations to the engine for the providers themselves. These are called "default providers".
ProviderRequest is useful as a hash key. The engine is free to instantiate any number of provider requests, but it is free to cache requests for a provider request that is equal to one that has already been serviced. If you do use ProviderRequest as a hash key, you should call String() to get a usable key for string-based hash maps.
func NewProviderRequest ¶
func NewProviderRequest(version *semver.Version, pkg tokens.Package) ProviderRequest
NewProviderRequest constructs a new provider request from an optional version and package.
func (ProviderRequest) Name ¶
func (p ProviderRequest) Name() tokens.QName
Name returns a QName that is an appropriate name for a default provider constructed from this provider request. The name is intended to be unique; as such, the name is derived from the version associated with this request.
If a version is not provided, "default" is returned. Otherwise, Name returns a name starting with "default" and followed by a QName-legal representation of the semantic version of the requested provider.
func (ProviderRequest) Package ¶
func (p ProviderRequest) Package() tokens.Package
Package returns this provider request's package.
func (ProviderRequest) String ¶
func (p ProviderRequest) String() string
String returns a string representation of this request. This string is suitable for use as a hash key.
func (ProviderRequest) Version ¶
func (p ProviderRequest) Version() *semver.Version
Version returns this provider request's version. May be nil if no version was provided.
type Reference ¶
type Reference struct {
// contains filtered or unexported fields
}
Reference represents a reference to a particular provider.
func NewReference ¶
NewReference creates a new reference for the given URN and ID.
func ParseReference ¶
ParseReference parses the URN and ID from the string representation of a provider reference. If parsing was not possible, this function returns false.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages the lifecylce of provider resources and their plugins and handles the resolution of provider references to loaded plugins.
When a registry is created, it is handed the set of old provider resources that it will manage. Each provider resource in this set is loaded and configured as per its recorded inputs and registered under the provider reference that corresponds to its URN and ID, both of which must be known. At this point, the created registry is prepared to be used to manage the lifecycle of these providers as well as any new provider resources requested by invoking the registry's CRUD operations.
In order to fit neatly in to the existing infrastructure for managing resources using Pulumi, a provider regidstry itself implements the plugin.Provider interface.
func NewRegistry ¶
func NewRegistry(host plugin.Host, prev []*resource.State, isPreview bool, builtins plugin.Provider) (*Registry, error)
NewRegistry creates a new provider registry using the given host and old resources. Each provider present in the old resources will be loaded, configured, and added to the returned registry under its reference. If any provider is not loadable/configurable or has an invalid ID, this function returns an error.
func (*Registry) Check ¶
func (r *Registry) Check(urn resource.URN, olds, news resource.PropertyMap, allowUnknowns bool) (resource.PropertyMap, []plugin.CheckFailure, error)
Check validates the configuration for a particular provider resource.
The particulars of Check are a bit subtle for a few reasons:
- we need to load the provider for the package indicated by the type name portion provider resource's URN in order to check its config
- we need to keep the newly-loaded provider around in case we need to diff its config
- if we are running a preview, we need to configure the provider, as its corresponding CRUD operations will not run (we would normally configure the provider in Create or Update).
func (*Registry) CheckConfig ¶
func (r *Registry) CheckConfig(urn resource.URN, olds, news resource.PropertyMap, allowUnknowns bool) (resource.PropertyMap, []plugin.CheckFailure, error)
CheckConfig validates the configuration for this resource provider.
func (*Registry) Construct ¶ added in v2.10.0
func (r *Registry) Construct(info plugin.ConstructInfo, typ tokens.Type, name tokens.QName, parent resource.URN, inputs resource.PropertyMap, options plugin.ConstructOptions) (plugin.ConstructResult, error)
func (*Registry) Create ¶
func (r *Registry) Create(urn resource.URN, news resource.PropertyMap, timeout float64, preview bool) (resource.ID, resource.PropertyMap, resource.Status, error)
Create coonfigures the provider with the given URN using the indicated configuration, assigns it an ID, and registers it under the assigned (URN, ID).
The provider must have been loaded by a prior call to Check.
func (*Registry) Delete ¶
func (r *Registry) Delete(urn resource.URN, id resource.ID, props resource.PropertyMap, timeout float64) (resource.Status, error)
Delete unregisters and unloads the provider with the given URN and ID. The provider must have been loaded when the registry was created (i.e. it must have been present in the state handed to NewRegistry).
func (*Registry) Diff ¶
func (r *Registry) Diff(urn resource.URN, id resource.ID, olds, news resource.PropertyMap, allowUnknowns bool, ignoreChanges []string) (plugin.DiffResult, error)
Diff diffs the configuration of the indicated provider. The provider corresponding to the given URN must have previously been loaded by a call to Check.
func (*Registry) DiffConfig ¶
func (r *Registry) DiffConfig(urn resource.URN, olds, news resource.PropertyMap, allowUnknowns bool, ignoreChanges []string) (plugin.DiffResult, error)
DiffConfig checks what impacts a hypothetical change to this provider's configuration will have on the provider.
func (*Registry) GetPluginInfo ¶
func (r *Registry) GetPluginInfo() (workspace.PluginInfo, error)
func (*Registry) GetProvider ¶
GetProvider returns the provider plugin that is currently registered under the given reference, if any.
func (*Registry) Invoke ¶
func (r *Registry) Invoke(tok tokens.ModuleMember, args resource.PropertyMap) (resource.PropertyMap, []plugin.CheckFailure, error)
func (*Registry) SignalCancellation ¶
func (*Registry) StreamInvoke ¶
func (r *Registry) StreamInvoke( tok tokens.ModuleMember, args resource.PropertyMap, onNext func(resource.PropertyMap) error) ([]plugin.CheckFailure, error)
func (*Registry) Update ¶
func (r *Registry) Update(urn resource.URN, id resource.ID, olds, news resource.PropertyMap, timeout float64, ignoreChanges []string, preview bool) (resource.PropertyMap, resource.Status, error)
Update configures the provider with the given URN and ID using the indicated configuration and registers it at the reference indicated by the (URN, ID) pair.
THe provider must have been loaded by a prior call to Check.