plugin

package
v2.25.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: Apache-2.0 Imports: 42 Imported by: 22

Documentation

Index

Constants

View Source
const (
	// UnknownBoolValue is a sentinel indicating that a bool property's value is not known, because it depends on
	// a computation with values whose values themselves are not yet known (e.g., dependent upon an output property).
	UnknownBoolValue = "1c4a061d-8072-4f0a-a4cb-0ff528b18fe7"
	// UnknownNumberValue is a sentinel indicating that a number property's value is not known, because it depends on
	// a computation with values whose values themselves are not yet known (e.g., dependent upon an output property).
	UnknownNumberValue = "3eeb2bf0-c639-47a8-9e75-3b44932eb421"
	// UnknownStringValue is a sentinel indicating that a string property's value is not known, because it depends on
	// a computation with values whose values themselves are not yet known (e.g., dependent upon an output property).
	UnknownStringValue = "04da6b54-80e4-46f7-96ec-b56ff0331ba9"
	// UnknownArrayValue is a sentinel indicating that an array property's value is not known, because it depends on
	// a computation with values whose values themselves are not yet known (e.g., dependent upon an output property).
	UnknownArrayValue = "6a19a0b0-7e62-4c92-b797-7f8e31da9cc2"
	// UnknownAssetValue is a sentinel indicating that an asset property's value is not known, because it depends on
	// a computation with values whose values themselves are not yet known (e.g., dependent upon an output property).
	UnknownAssetValue = "030794c1-ac77-496b-92df-f27374a8bd58"
	// UnknownArchiveValue is a sentinel indicating that an archive property's value is not known, because it depends
	// on a computation with values whose values themselves are not yet known (e.g., dependent upon an output property).
	UnknownArchiveValue = "e48ece36-62e2-4504-bad9-02848725956a"
	// UnknownObjectValue is a sentinel indicating that an archive property's value is not known, because it depends
	// on a computation with values whose values themselves are not yet known (e.g., dependent upon an output property).
	UnknownObjectValue = "dd056dcd-154b-4c76-9bd3-c8f88648b5ff"
)

Variables

AllPlugins uses flags to ensure that all plugin kinds are loaded.

View Source
var ErrNotYetImplemented = errors.New("NYI")

ErrNotYetImplemented may be returned from a provider for optional methods that are not yet implemented.

Functions

func GetRequiredPlugins added in v2.10.1

func GetRequiredPlugins(host Host, info ProgInfo, kinds Flags) ([]workspace.PluginInfo, error)

GetRequiredPlugins lists a full set of plugins that will be required by the given program.

func MarshalArchive

func MarshalArchive(v *resource.Archive, opts MarshalOptions) (*structpb.Value, error)

MarshalArchive marshals an archive into its wire form for resource provider plugins.

func MarshalAsset

func MarshalAsset(v *resource.Asset, opts MarshalOptions) (*structpb.Value, error)

MarshalAsset marshals an asset into its wire form for resource provider plugins.

func MarshalNull

func MarshalNull(opts MarshalOptions) *structpb.Value

MarshalNull marshals a nil to its protobuf form.

func MarshalProperties

func MarshalProperties(props resource.PropertyMap, opts MarshalOptions) (*structpb.Struct, error)

MarshalProperties marshals a resource's property map as a "JSON-like" protobuf structure.

func MarshalPropertyValue

func MarshalPropertyValue(v resource.PropertyValue, opts MarshalOptions) (*structpb.Value, error)

MarshalPropertyValue marshals a single resource property value into its "JSON-like" value representation.

func MarshalString

func MarshalString(s string, opts MarshalOptions) *structpb.Value

MarshalString marshals a string to its protobuf form.

func MarshalStruct

func MarshalStruct(obj *structpb.Struct, opts MarshalOptions) *structpb.Value

MarshalStruct marshals a struct for use in a protobuf field where a value is expected.

func NewCheckResponse

func NewCheckResponse(err error) *lumirpc.CheckResponse

NewCheckResponse produces a response with property validation failures from the given array of mapper failures.

func NewProviderServer added in v2.16.2

func NewProviderServer(provider Provider) pulumirpc.ResourceProviderServer

func UnmarshalProperties

func UnmarshalProperties(props *structpb.Struct, opts MarshalOptions) (resource.PropertyMap, error)

UnmarshalProperties unmarshals a "JSON-like" protobuf structure into a new resource property map.

func UnmarshalPropertyValue

func UnmarshalPropertyValue(v *structpb.Value, opts MarshalOptions) (*resource.PropertyValue, error)

UnmarshalPropertyValue unmarshals a single "JSON-like" value into a new property value.

Types

type AnalyzeDiagnostic

type AnalyzeDiagnostic struct {
	PolicyName        string
	PolicyPackName    string
	PolicyPackVersion string
	Description       string
	Message           string
	Tags              []string
	EnforcementLevel  apitype.EnforcementLevel
	URN               resource.URN
}

AnalyzeDiagnostic indicates that resource analysis failed; it contains the property and reason for the failure.

type Analyzer

type Analyzer interface {
	// Closer closes any underlying OS resources associated with this provider (like processes, RPC channels, etc).
	io.Closer
	// Name fetches an analyzer's qualified name.
	Name() tokens.QName
	// Analyze analyzes a single resource object, and returns any errors that it finds.
	// Is called before the resource is modified.
	Analyze(r AnalyzerResource) ([]AnalyzeDiagnostic, error)
	// AnalyzeStack analyzes all resources after a successful preview or update.
	// Is called after all resources have been processed, and all changes applied.
	AnalyzeStack(resources []AnalyzerStackResource) ([]AnalyzeDiagnostic, error)
	// GetAnalyzerInfo returns metadata about the analyzer (e.g., list of policies contained).
	GetAnalyzerInfo() (AnalyzerInfo, error)
	// GetPluginInfo returns this plugin's information.
	GetPluginInfo() (workspace.PluginInfo, error)
	// Configure configures the analyzer, passing configuration properties for each policy.
	Configure(policyConfig map[string]AnalyzerPolicyConfig) error
}

Analyzer provides a pluggable interface for performing arbitrary analysis of entire projects/stacks/snapshots, and/or individual resources, for arbitrary issues. These might be style, policy, correctness, security, or performance related. This interface hides the messiness of the underlying machinery, since providers are behind an RPC boundary.

func NewAnalyzer

func NewAnalyzer(host Host, ctx *Context, name tokens.QName) (Analyzer, error)

NewAnalyzer binds to a given analyzer's plugin by name and creates a gRPC connection to it. If the associated plugin could not be found by name on the PATH, or an error occurs while creating the child process, an error is returned.

func NewPolicyAnalyzer

func NewPolicyAnalyzer(
	host Host, ctx *Context, name tokens.QName, policyPackPath string, opts *PolicyAnalyzerOptions) (Analyzer, error)

NewPolicyAnalyzer boots the nodejs analyzer plugin located at `policyPackpath`

type AnalyzerInfo

type AnalyzerInfo struct {
	Name           string
	DisplayName    string
	Version        string
	SupportsConfig bool
	Policies       []AnalyzerPolicyInfo
	InitialConfig  map[string]AnalyzerPolicyConfig
}

AnalyzerInfo provides metadata about a PolicyPack inside an analyzer.

type AnalyzerPolicyConfig

type AnalyzerPolicyConfig struct {
	// Configured enforcement level for the policy.
	EnforcementLevel apitype.EnforcementLevel
	// Configured properties of the policy.
	Properties map[string]interface{}
}

AnalyzerPolicyConfig is the configuration for a policy.

type AnalyzerPolicyConfigSchema

type AnalyzerPolicyConfigSchema struct {
	// Map of config property names to JSON schema.
	Properties map[string]JSONSchema

	// Required config properties
	Required []string
}

AnalyzerPolicyConfigSchema provides metadata about a policy's configuration.

type AnalyzerPolicyInfo

type AnalyzerPolicyInfo struct {
	// Unique URL-safe name for the policy.  This is unique to a specific version
	// of a Policy Pack.
	Name        string
	DisplayName string

	// Description is used to provide more context about the purpose of the policy.
	Description      string
	EnforcementLevel apitype.EnforcementLevel

	// Message is the message that will be displayed to end users when they violate
	// this policy.
	Message string

	// ConfigSchema is optional config schema for the policy.
	ConfigSchema *AnalyzerPolicyConfigSchema
}

AnalyzerPolicyInfo defines the metadata for an individual Policy within a Policy Pack.

type AnalyzerProviderResource

type AnalyzerProviderResource struct {
	URN        resource.URN
	Type       tokens.Type
	Name       tokens.QName
	Properties resource.PropertyMap
}

AnalyzerProviderResource mirrors a resource's provider sent to the analyzer.

type AnalyzerResource

type AnalyzerResource struct {
	URN        resource.URN
	Type       tokens.Type
	Name       tokens.QName
	Properties resource.PropertyMap
	Options    AnalyzerResourceOptions
	Provider   *AnalyzerProviderResource
}

AnalyzerResource mirrors a resource that is passed to `Analyze`.

type AnalyzerResourceOptions

type AnalyzerResourceOptions struct {
	Protect                 bool                    // true to protect this resource from deletion.
	IgnoreChanges           []string                // a list of property names to ignore during changes.
	DeleteBeforeReplace     *bool                   // true if this resource should be deleted prior to replacement.
	AdditionalSecretOutputs []resource.PropertyKey  // outputs that should always be treated as secrets.
	Aliases                 []resource.URN          // additional URNs that should be aliased to this resource.
	CustomTimeouts          resource.CustomTimeouts // an optional config object for resource options
}

AnalyzerResourceOptions mirrors resource options sent to the analyzer.

type AnalyzerStackResource

type AnalyzerStackResource struct {
	AnalyzerResource
	Parent               resource.URN                            // an optional parent URN for this resource.
	Dependencies         []resource.URN                          // dependencies of this resource object.
	PropertyDependencies map[resource.PropertyKey][]resource.URN // the set of dependencies that affect each property.
}

AnalyzerStackResource mirrors a resource that is passed to `AnalyzeStack`.

type CheckFailure

type CheckFailure struct {
	Property resource.PropertyKey // the property that failed checking.
	Reason   string               // the reason the property failed to check.
}

CheckFailure indicates that a call to check failed; it contains the property and reason for the failure.

type ConfigSource

type ConfigSource interface {
	// GetPackageConfig returns the set of configuration parameters for the indicated package, if any.
	GetPackageConfig(pkg tokens.Package) (resource.PropertyMap, error)
}

ConfigSource is an interface that allows a plugin context to fetch configuration data for a plugin named by package.

type ConstructInfo added in v2.10.0

type ConstructInfo struct {
	Project        string                // the project name housing the program being run.
	Stack          string                // the stack name being evaluated.
	Config         map[config.Key]string // the configuration variables to apply before running.
	DryRun         bool                  // true if we are performing a dry-run (preview).
	Parallel       int                   // the degree of parallelism for resource operations (<=1 for serial).
	MonitorAddress string                // the RPC address to the host resource monitor.
}

ConstructInfo contains all of the information required to register resources as part of a call to Construct.

type ConstructOptions added in v2.10.0

type ConstructOptions struct {
	// Aliases is the set of aliases for the component.
	Aliases []resource.URN
	// Dependencies is the list of resources this component depends on.
	Dependencies []resource.URN
	// Protect is true if the component is protected.
	Protect bool
	// Providers is a map from package name to provider reference.
	Providers map[string]string
	// PropertyDependencies is a map from property name to a list of resources that property depends on.
	PropertyDependencies map[resource.PropertyKey][]resource.URN
}

ConstructOptions captures options for a call to Construct.

type ConstructResult added in v2.10.0

type ConstructResult struct {
	// The URN of the constructed component resource.
	URN resource.URN
	// The output properties of the component resource.
	Outputs resource.PropertyMap
	// The resources that each output property depends on.
	OutputDependencies map[resource.PropertyKey][]resource.URN
}

ConstructResult is the result of a call to Construct.

type Context

type Context struct {
	Diag       diag.Sink // the diagnostics sink to use for messages.
	StatusDiag diag.Sink // the diagnostics sink to use for status messages.
	Host       Host      // the host that can be used to fetch providers.
	Pwd        string    // the working directory to spawn all plugins in.
	// contains filtered or unexported fields
}

Context is used to group related operations together so that associated OS resources can be cached, shared, and reclaimed as appropriate.

func NewContext

func NewContext(d, statusD diag.Sink, host Host, cfg ConfigSource,
	pwd string, runtimeOptions map[string]interface{}, disableProviderPreview bool,
	parentSpan opentracing.Span) (*Context, error)

NewContext allocates a new context with a given sink and host. Note that the host is "owned" by this context from here forwards, such that when the context's resources are reclaimed, so too are the host's.

func (*Context) Close

func (ctx *Context) Close() error

Close reclaims all resources associated with this context.

func (*Context) Request

func (ctx *Context) Request() context.Context

Request allocates a request sub-context.

type DiffChanges

type DiffChanges int

DiffChanges represents the kind of changes detected by a diff operation.

const (
	// DiffUnknown indicates the provider didn't offer information about the changes (legacy behavior).
	DiffUnknown DiffChanges = 0
	// DiffNone indicates the provider performed a diff and concluded that no update is needed.
	DiffNone DiffChanges = 1
	// DiffSome indicates the provider performed a diff and concluded that an update or replacement is needed.
	DiffSome DiffChanges = 2
)

type DiffKind

type DiffKind int

DiffKind represents the kind of diff that applies to a particular property.

const (
	// DiffAdd indicates that the property was added.
	DiffAdd DiffKind = 0
	// DiffAddReplace indicates that the property was added and requires that the resource be replaced.
	DiffAddReplace DiffKind = 1
	// DiffDelete indicates that the property was deleted.
	DiffDelete DiffKind = 2
	// DiffDeleteReplace indicates that the property was added and requires that the resource be replaced.
	DiffDeleteReplace DiffKind = 3
	// DiffUpdate indicates that the property was updated.
	DiffUpdate DiffKind = 4
	// DiffUpdateReplace indicates that the property was updated and requires that the resource be replaced.
	DiffUpdateReplace DiffKind = 5
)

func (DiffKind) IsReplace

func (d DiffKind) IsReplace() bool

func (DiffKind) String

func (d DiffKind) String() string

type DiffResult

type DiffResult struct {
	Changes             DiffChanges             // true if this diff represents a changed resource.
	ReplaceKeys         []resource.PropertyKey  // an optional list of replacement keys.
	StableKeys          []resource.PropertyKey  // an optional list of property keys that are stable.
	ChangedKeys         []resource.PropertyKey  // an optional list of keys that changed.
	DetailedDiff        map[string]PropertyDiff // an optional structured diff
	DeleteBeforeReplace bool                    // if true, this resource must be deleted before recreating it.
}

DiffResult indicates whether an operation should replace or update an existing resource.

func (DiffResult) Replace

func (r DiffResult) Replace() bool

Replace returns true if this diff represents a replacement.

type DiffUnavailableError

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

DiffUnavailableError may be returned by a provider if the provider is unable to diff a resource.

func DiffUnavailable

func DiffUnavailable(reason string) DiffUnavailableError

DiffUnavailable creates a new DiffUnavailableError with the given message.

func (DiffUnavailableError) Error

func (e DiffUnavailableError) Error() string

Error returns the error message for this DiffUnavailableError.

type Flags

type Flags int

Flags can be used to filter out plugins during loading that aren't necessary.

const (
	// AnalyzerPlugins is used to only load analyzers.
	AnalyzerPlugins Flags = 1 << iota
	// LanguagePlugins is used to only load language plugins.
	LanguagePlugins
	// ResourcePlugins is used to only load resource provider plugins.
	ResourcePlugins
)

type Host

type Host interface {
	// ServerAddr returns the address at which the host's RPC interface may be found.
	ServerAddr() string

	// Log logs a message, including errors and warnings.  Messages can have a resource URN
	// associated with them.  If no urn is provided, the message is global.
	Log(sev diag.Severity, urn resource.URN, msg string, streamID int32)

	// LogStatus logs a status message message, including errors and warnings. Status messages show
	// up in the `Info` column of the progress display, but not in the final output. Messages can
	// have a resource URN associated with them.  If no urn is provided, the message is global.
	LogStatus(sev diag.Severity, urn resource.URN, msg string, streamID int32)

	// Analyzer fetches the analyzer with a given name, possibly lazily allocating the plugins for
	// it.  If an analyzer could not be found, or an error occurred while creating it, a non-nil
	// error is returned.
	Analyzer(nm tokens.QName) (Analyzer, error)

	// PolicyAnalyzer boots the nodejs analyzer plugin located at a given path. This is useful
	// because policy analyzers generally do not need to be "discovered" -- the engine is given a
	// set of policies that are required to be run during an update, so they tend to be in a
	// well-known place.
	PolicyAnalyzer(name tokens.QName, path string, opts *PolicyAnalyzerOptions) (Analyzer, error)

	// ListAnalyzers returns a list of all analyzer plugins known to the plugin host.
	ListAnalyzers() []Analyzer

	// Provider loads a new copy of the provider for a given package.  If a provider for this package could not be
	// found, or an error occurs while creating it, a non-nil error is returned.
	Provider(pkg tokens.Package, version *semver.Version) (Provider, error)
	// CloseProvider closes the given provider plugin and deregisters it from this host.
	CloseProvider(provider Provider) error
	// LanguageRuntime fetches the language runtime plugin for a given language, lazily allocating if necessary.  If
	// an implementation of this language runtime wasn't found, on an error occurs, a non-nil error is returned.
	LanguageRuntime(runtime string) (LanguageRuntime, error)

	// ListPlugins lists all plugins that have been loaded, with version information.
	ListPlugins() []workspace.PluginInfo
	// EnsurePlugins ensures all plugins in the given array are loaded and ready to use.  If any plugins are missing,
	// and/or there are errors loading one or more plugins, a non-nil error is returned.
	EnsurePlugins(plugins []workspace.PluginInfo, kinds Flags) error

	// SignalCancellation asks all resource providers to gracefully shut down and abort any ongoing
	// operations. Operation aborted in this way will return an error (e.g., `Update` and `Create`
	// will either a creation error or an initialization error. SignalCancellation is advisory and
	// non-blocking; it is up to the host to decide how long to wait after SignalCancellation is
	// called before (e.g.) hard-closing any gRPC connection.
	SignalCancellation() error

	// Close reclaims any resources associated with the host.
	Close() error
}

A Host hosts provider plugins and makes them easily accessible by package name.

func NewDefaultHost

func NewDefaultHost(ctx *Context, config ConfigSource, runtimeOptions map[string]interface{},
	disableProviderPreview bool) (Host, error)

NewDefaultHost implements the standard plugin logic, using the standard installation root to find them.

type InitError

type InitError struct {
	Reasons []string
}

InitError represents a failure to initialize a resource, i.e., the resource has been successfully created, but it has failed to initialize.

func (*InitError) Error

func (ie *InitError) Error() string

type JSONSchema

type JSONSchema map[string]interface{}

JSONSchema represents a JSON schema.

type LanguageRuntime

type LanguageRuntime interface {
	// Closer closes any underlying OS resources associated with this plugin (like processes, RPC channels, etc).
	io.Closer
	// GetRequiredPlugins computes the complete set of anticipated plugins required by a program.
	GetRequiredPlugins(info ProgInfo) ([]workspace.PluginInfo, error)
	// Run executes a program in the language runtime for planning or deployment purposes.  If
	// info.DryRun is true, the code must not assume that side-effects or final values resulting
	// from resource deployments are actually available.  If it is false, on the other hand, a real
	// deployment is occurring and it may safely depend on these.
	//
	// Returns a triple of "error message", "bail", or real "error".  If "bail", the caller should
	// return result.Bail immediately and not print any further messages to the user.
	Run(info RunInfo) (string, bool, error)
	// GetPluginInfo returns this plugin's information.
	GetPluginInfo() (workspace.PluginInfo, error)
}

LanguageRuntime is a convenient interface for interacting with language runtime plugins. These tend to be dynamically loaded as plugins, although this interface hides this fact from the calling code.

func NewLanguageRuntime

func NewLanguageRuntime(host Host, ctx *Context, runtime string,
	options map[string]interface{}) (LanguageRuntime, error)

NewLanguageRuntime binds to a language's runtime plugin and then creates a gRPC connection to it. If the plugin could not be found, or an error occurs while creating the child process, an error is returned.

func NewLanguageRuntimeClient added in v2.10.1

func NewLanguageRuntimeClient(ctx *Context, runtime string, client pulumirpc.LanguageRuntimeClient) LanguageRuntime

type MarshalOptions

type MarshalOptions struct {
	Label              string // an optional label for debugging.
	SkipNulls          bool   // true to skip nulls altogether in the resulting map.
	KeepUnknowns       bool   // true if we are keeping unknown values (otherwise we skip them).
	RejectUnknowns     bool   // true if we should return errors on unknown values. Takes precedence over KeepUnknowns.
	ElideAssetContents bool   // true if we are eliding the contents of assets.
	ComputeAssetHashes bool   // true if we are computing missing asset hashes on the fly.
	KeepSecrets        bool   // true if we are keeping secrets (otherwise we replace them with their underlying value).
	RejectAssets       bool   // true if we should return errors on Asset and Archive values.
	KeepResources      bool   // true if we are keeping resoures (otherwise we return raw urn).
	SkipInternalKeys   bool   // true to skip internal property keys (keys that start with "__") in the resulting map.
}

MarshalOptions controls the marshaling of RPC structures.

type PolicyAnalyzerOptions

type PolicyAnalyzerOptions struct {
	Project string
	Stack   string
	Config  map[config.Key]string
	DryRun  bool
}

PolicyAnalyzerOptions includes a bag of options to pass along to a policy analyzer.

type ProgInfo

type ProgInfo struct {
	Proj    *workspace.Project // the program project/package.
	Pwd     string             // the program's working directory.
	Program string             // the path to the program to execute.
}

ProgInfo contains minimal information about the program to be run.

type PropertyDiff

type PropertyDiff struct {
	Kind      DiffKind // The kind of diff.
	InputDiff bool     // True if this is a diff between old and new inputs rather than old state and new inputs.
}

PropertyDiff records the difference between a single property's old and new values.

type Provider

type Provider interface {
	// Closer closes any underlying OS resources associated with this provider (like processes, RPC channels, etc).
	io.Closer
	// Pkg fetches this provider's package.
	Pkg() tokens.Package

	// GetSchema returns the schema for the provider.
	GetSchema(version int) ([]byte, error)

	// CheckConfig validates the configuration for this resource provider.
	CheckConfig(urn resource.URN, olds, news resource.PropertyMap,
		allowUnknowns bool) (resource.PropertyMap, []CheckFailure, error)
	// DiffConfig checks what impacts a hypothetical change to this provider's configuration will have on the provider.
	DiffConfig(urn resource.URN, olds, news resource.PropertyMap, allowUnknowns bool,
		ignoreChanges []string) (DiffResult, error)
	// Configure configures the resource provider with "globals" that control its behavior.
	Configure(inputs resource.PropertyMap) error

	// Check validates that the given property bag is valid for a resource of the given type and returns the inputs
	// that should be passed to successive calls to Diff, Create, or Update for this resource.
	Check(urn resource.URN, olds, news resource.PropertyMap,
		allowUnknowns bool) (resource.PropertyMap, []CheckFailure, error)
	// Diff checks what impacts a hypothetical update will have on the resource's properties.
	Diff(urn resource.URN, id resource.ID, olds resource.PropertyMap, news resource.PropertyMap,
		allowUnknowns bool, ignoreChanges []string) (DiffResult, error)
	// Create allocates a new instance of the provided resource and returns its unique resource.ID.
	Create(urn resource.URN, news resource.PropertyMap, timeout float64, preview bool) (resource.ID,
		resource.PropertyMap, resource.Status, error)
	// Read the current live state associated with a resource.  Enough state must be include in the inputs to uniquely
	// identify the resource; this is typically just the resource ID, but may also include some properties.  If the
	// resource is missing (for instance, because it has been deleted), the resulting property map will be nil.
	Read(urn resource.URN, id resource.ID,
		inputs, state resource.PropertyMap) (ReadResult, resource.Status, error)
	// Update updates an existing resource with new values.
	Update(urn resource.URN, id resource.ID,
		olds resource.PropertyMap, news resource.PropertyMap, timeout float64,
		ignoreChanges []string, preview bool) (resource.PropertyMap, resource.Status, error)
	// Delete tears down an existing resource.
	Delete(urn resource.URN, id resource.ID, props resource.PropertyMap, timeout float64) (resource.Status, error)

	// Construct creates a new component resource.
	Construct(info ConstructInfo, typ tokens.Type, name tokens.QName, parent resource.URN, inputs resource.PropertyMap,
		options ConstructOptions) (ConstructResult, error)

	// Invoke dynamically executes a built-in function in the provider.
	Invoke(tok tokens.ModuleMember, args resource.PropertyMap) (resource.PropertyMap, []CheckFailure, error)
	// StreamInvoke dynamically executes a built-in function in the provider, which returns a stream
	// of responses.
	StreamInvoke(
		tok tokens.ModuleMember,
		args resource.PropertyMap,
		onNext func(resource.PropertyMap) error) ([]CheckFailure, error)
	// GetPluginInfo returns this plugin's information.
	GetPluginInfo() (workspace.PluginInfo, error)

	// SignalCancellation asks all resource providers to gracefully shut down and abort any ongoing
	// operations. Operation aborted in this way will return an error (e.g., `Update` and `Create`
	// will either a creation error or an initialization error. SignalCancellation is advisory and
	// non-blocking; it is up to the host to decide how long to wait after SignalCancellation is
	// called before (e.g.) hard-closing any gRPC connection.
	SignalCancellation() error
}

Provider presents a simple interface for orchestrating resource create, read, update, and delete operations. Each provider understands how to handle all of the resource types within a single package.

This interface hides some of the messiness of the underlying machinery, since providers are behind an RPC boundary.

It is important to note that provider operations are not transactional. (Some providers might decide to offer transactional semantics, but such a provider is a rare treat.) As a result, failures in the operations below can range from benign to catastrophic (possibly leaving behind a corrupt resource). It is up to the provider to make a best effort to ensure catastrophes do not occur. The errors returned from mutating operations indicate both the underlying error condition in addition to a bit indicating whether the operation was successfully rolled back.

func NewProvider

func NewProvider(host Host, ctx *Context, pkg tokens.Package, version *semver.Version,
	options map[string]interface{}, disableProviderPreview bool) (Provider, error)

NewProvider attempts to bind to a given package's resource plugin and then creates a gRPC connection to it. If the plugin could not be found, or an error occurs while creating the child process, an error is returned.

func NewProviderWithClient added in v2.16.2

func NewProviderWithClient(ctx *Context, pkg tokens.Package, client pulumirpc.ResourceProviderClient,
	disableProviderPreview bool) Provider

type PulumiPluginJSON added in v2.15.1

type PulumiPluginJSON struct {
	// Indicates whether the package has an associated resource plugin. Set to false to indicate no plugin.
	Resource bool `json:"resource"`
	// Optional plugin name. If not set, the plugin name is derived from the package name.
	Name string `json:"name,omitempty"`
	// Optional plugin version. If not set, the version is derived from the package version (if possible).
	Version string `json:"version,omitempty"`
	// Optional plugin server. If not set, the default server is used when installing the plugin.
	Server string `json:"server,omitempty"`
}

PulumiPluginJSON represents additional information about a package's associated Pulumi plugin. For Python, the content is inside a pulumiplugin.json file inside the package. For Node.js, the content is within the package.json file, under the "pulumi" node. This is not currently used for .NET or Go, but we could consider adopting it for those languages.

func LoadPulumiPluginJSON added in v2.15.1

func LoadPulumiPluginJSON(path string) (*PulumiPluginJSON, error)

func (*PulumiPluginJSON) JSON added in v2.15.1

func (plugin *PulumiPluginJSON) JSON() ([]byte, error)

type ReadResult

type ReadResult struct {
	// This is the ID for the resource. This ID will always be populated and will ensure we get the most up-to-date
	// resource ID.
	ID resource.ID
	// Inputs contains the new inputs for the resource, if any. If this field is nil, the provider does not support
	// returning inputs from a call to Read and the old inputs (if any) should be preserved.
	Inputs resource.PropertyMap
	// Outputs contains the new outputs/state for the resource, if any. If this field is nil, the resource does not
	// exist.
	Outputs resource.PropertyMap
}

ReadResult is the result of a call to Read.

type RunInfo

type RunInfo struct {
	MonitorAddress string                // the RPC address to the host resource monitor.
	Project        string                // the project name housing the program being run.
	Stack          string                // the stack name being evaluated.
	Pwd            string                // the program's working directory.
	Program        string                // the path to the program to execute.
	Args           []string              // any arguments to pass to the program.
	Config         map[config.Key]string // the configuration variables to apply before running.
	DryRun         bool                  // true if we are performing a dry-run (preview).
	QueryMode      bool                  // true if we're only doing a query.
	Parallel       int                   // the degree of parallelism for resource operations (<=1 for serial).
}

RunInfo contains all of the information required to perform a plan or deployment operation.

Jump to

Keyboard shortcuts

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