Documentation ¶
Overview ¶
Package deploy contains the logic for planning and executing resource deployments. This includes the following: - Manage the deployment lifecycle by coordinating the execution and parallelism of the underlying operations. - A builtin provider for interacting with the engine.
Index ¶
- Variables
- type BackendClient
- type CreateStep
- func (s *CreateStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
- func (s *CreateStep) Deployment() *Deployment
- func (s *CreateStep) DetailedDiff() map[string]plugin.PropertyDiff
- func (s *CreateStep) Diffs() []resource.PropertyKey
- func (s *CreateStep) Keys() []resource.PropertyKey
- func (s *CreateStep) Logical() bool
- func (s *CreateStep) New() *resource.State
- func (s *CreateStep) Old() *resource.State
- func (s *CreateStep) Op() StepOp
- func (s *CreateStep) Provider() string
- func (s *CreateStep) Res() *resource.State
- func (s *CreateStep) Type() tokens.Type
- func (s *CreateStep) URN() resource.URN
- type DeleteStep
- func (s *DeleteStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
- func (s *DeleteStep) Deployment() *Deployment
- func (s *DeleteStep) Logical() bool
- func (s *DeleteStep) New() *resource.State
- func (s *DeleteStep) Old() *resource.State
- func (s *DeleteStep) Op() StepOp
- func (s *DeleteStep) Provider() string
- func (s *DeleteStep) Res() *resource.State
- func (s *DeleteStep) Type() tokens.Type
- func (s *DeleteStep) URN() resource.URN
- type Deployment
- func (d *Deployment) Ctx() *plugin.Context
- func (d *Deployment) Diag() diag.Sink
- func (d *Deployment) Execute(ctx context.Context, opts Options, preview bool) result.Result
- func (d *Deployment) GetProvider(ref providers.Reference) (plugin.Provider, bool)
- func (d *Deployment) Olds() map[resource.URN]*resource.State
- func (d *Deployment) Prev() *Snapshot
- func (d *Deployment) Source() Source
- func (d *Deployment) Target() *Target
- type EvalRunInfo
- type Events
- type Import
- type ImportOptions
- type ImportStep
- func (s *ImportStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
- func (s *ImportStep) Deployment() *Deployment
- func (s *ImportStep) DetailedDiff() map[string]plugin.PropertyDiff
- func (s *ImportStep) Diffs() []resource.PropertyKey
- func (s *ImportStep) Logical() bool
- func (s *ImportStep) New() *resource.State
- func (s *ImportStep) Old() *resource.State
- func (s *ImportStep) Op() StepOp
- func (s *ImportStep) Provider() string
- func (s *ImportStep) Res() *resource.State
- func (s *ImportStep) Type() tokens.Type
- func (s *ImportStep) URN() resource.URN
- type Manifest
- type Options
- type PlanPendingOperationsError
- type PolicyEvents
- type ProviderSource
- type QuerySource
- type ReadResourceEvent
- type ReadResult
- type ReadStep
- func (s *ReadStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
- func (s *ReadStep) Deployment() *Deployment
- func (s *ReadStep) Logical() bool
- func (s *ReadStep) New() *resource.State
- func (s *ReadStep) Old() *resource.State
- func (s *ReadStep) Op() StepOp
- func (s *ReadStep) Provider() string
- func (s *ReadStep) Res() *resource.State
- func (s *ReadStep) Type() tokens.Type
- func (s *ReadStep) URN() resource.URN
- type RefreshStep
- func (s *RefreshStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
- func (s *RefreshStep) Deployment() *Deployment
- func (s *RefreshStep) Logical() bool
- func (s *RefreshStep) New() *resource.State
- func (s *RefreshStep) Old() *resource.State
- func (s *RefreshStep) Op() StepOp
- func (s *RefreshStep) Provider() string
- func (s *RefreshStep) Res() *resource.State
- func (s *RefreshStep) ResultOp() StepOp
- func (s *RefreshStep) Type() tokens.Type
- func (s *RefreshStep) URN() resource.URN
- type RegisterResourceEvent
- type RegisterResourceOutputsEvent
- type RegisterResult
- type RemovePendingReplaceStep
- func (s *RemovePendingReplaceStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
- func (s *RemovePendingReplaceStep) Deployment() *Deployment
- func (s *RemovePendingReplaceStep) Logical() bool
- func (s *RemovePendingReplaceStep) New() *resource.State
- func (s *RemovePendingReplaceStep) Old() *resource.State
- func (s *RemovePendingReplaceStep) Op() StepOp
- func (s *RemovePendingReplaceStep) Provider() string
- func (s *RemovePendingReplaceStep) Res() *resource.State
- func (s *RemovePendingReplaceStep) Type() tokens.Type
- func (s *RemovePendingReplaceStep) URN() resource.URN
- type ReplaceStep
- func (s *ReplaceStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
- func (s *ReplaceStep) Deployment() *Deployment
- func (s *ReplaceStep) DetailedDiff() map[string]plugin.PropertyDiff
- func (s *ReplaceStep) Diffs() []resource.PropertyKey
- func (s *ReplaceStep) Keys() []resource.PropertyKey
- func (s *ReplaceStep) Logical() bool
- func (s *ReplaceStep) New() *resource.State
- func (s *ReplaceStep) Old() *resource.State
- func (s *ReplaceStep) Op() StepOp
- func (s *ReplaceStep) Provider() string
- func (s *ReplaceStep) Res() *resource.State
- func (s *ReplaceStep) Type() tokens.Type
- func (s *ReplaceStep) URN() resource.URN
- type SameStep
- func (s *SameStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
- func (s *SameStep) Deployment() *Deployment
- func (s *SameStep) IsSkippedCreate() bool
- func (s *SameStep) Logical() bool
- func (s *SameStep) New() *resource.State
- func (s *SameStep) Old() *resource.State
- func (s *SameStep) Op() StepOp
- func (s *SameStep) Provider() string
- func (s *SameStep) Res() *resource.State
- func (s *SameStep) Type() tokens.Type
- func (s *SameStep) URN() resource.URN
- type Snapshot
- type Source
- type SourceEvent
- type SourceIterator
- type SourceResourceMonitor
- type Step
- func NewCreateReplacementStep(deployment *Deployment, reg RegisterResourceEvent, old, new *resource.State, ...) Step
- func NewCreateStep(deployment *Deployment, reg RegisterResourceEvent, new *resource.State) Step
- func NewDeleteReplacementStep(deployment *Deployment, old *resource.State, pendingReplace bool) Step
- func NewDeleteStep(deployment *Deployment, old *resource.State) Step
- func NewImportReplacementStep(deployment *Deployment, reg RegisterResourceEvent, ...) Step
- func NewImportStep(deployment *Deployment, reg RegisterResourceEvent, new *resource.State, ...) Step
- func NewReadReplacementStep(deployment *Deployment, event ReadResourceEvent, old, new *resource.State) Step
- func NewReadStep(deployment *Deployment, event ReadResourceEvent, old, new *resource.State) Step
- func NewRefreshStep(deployment *Deployment, old *resource.State, done chan<- bool) Step
- func NewRemovePendingReplaceStep(deployment *Deployment, old *resource.State) Step
- func NewReplaceStep(deployment *Deployment, old, new *resource.State, ...) Step
- func NewSameStep(deployment *Deployment, reg RegisterResourceEvent, old, new *resource.State) Step
- func NewSkippedCreateStep(deployment *Deployment, reg RegisterResourceEvent, new *resource.State) Step
- func NewUpdateStep(deployment *Deployment, reg RegisterResourceEvent, old, new *resource.State, ...) Step
- type StepCompleteFunc
- type StepExecutorEvents
- type StepOp
- type Target
- type UpdateStep
- func (s *UpdateStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
- func (s *UpdateStep) Deployment() *Deployment
- func (s *UpdateStep) DetailedDiff() map[string]plugin.PropertyDiff
- func (s *UpdateStep) Diffs() []resource.PropertyKey
- func (s *UpdateStep) Logical() bool
- func (s *UpdateStep) New() *resource.State
- func (s *UpdateStep) Old() *resource.State
- func (s *UpdateStep) Op() StepOp
- func (s *UpdateStep) Provider() string
- func (s *UpdateStep) Res() *resource.State
- func (s *UpdateStep) Type() tokens.Type
- func (s *UpdateStep) URN() resource.URN
Constants ¶
This section is empty.
Variables ¶
var StepOps = []StepOp{ OpSame, OpCreate, OpUpdate, OpDelete, OpReplace, OpCreateReplacement, OpDeleteReplaced, OpRead, OpReadReplacement, OpRefresh, OpReadDiscard, OpDiscardReplaced, OpRemovePendingReplace, OpImport, OpImportReplacement, }
StepOps contains the full set of step operation types.
Functions ¶
This section is empty.
Types ¶
type BackendClient ¶
type BackendClient interface { // GetStackOutputs returns the outputs (if any) for the named stack or an error if the stack cannot be found. GetStackOutputs(ctx context.Context, name string) (resource.PropertyMap, error) // GetStackResourceOutputs returns the resource outputs for a stack, or an error if the stack // cannot be found. Resources are retrieved from the latest stack snapshot, which may include // ongoing updates. They are returned in a `PropertyMap` mapping resource URN to another // `Propertymap` with members `type` (containing the Pulumi type ID for the resource) and // `outputs` (containing the resource outputs themselves). GetStackResourceOutputs(ctx context.Context, stackName string) (resource.PropertyMap, error) }
BackendClient is used to retrieve information about stacks from a backend.
type CreateStep ¶
type CreateStep struct {
// contains filtered or unexported fields
}
CreateStep is a mutating step that creates an entirely new resource.
func (*CreateStep) Apply ¶
func (s *CreateStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
func (*CreateStep) Deployment ¶ added in v2.15.0
func (s *CreateStep) Deployment() *Deployment
func (*CreateStep) DetailedDiff ¶
func (s *CreateStep) DetailedDiff() map[string]plugin.PropertyDiff
func (*CreateStep) Diffs ¶
func (s *CreateStep) Diffs() []resource.PropertyKey
func (*CreateStep) Keys ¶
func (s *CreateStep) Keys() []resource.PropertyKey
func (*CreateStep) Logical ¶
func (s *CreateStep) Logical() bool
func (*CreateStep) New ¶
func (s *CreateStep) New() *resource.State
func (*CreateStep) Old ¶
func (s *CreateStep) Old() *resource.State
func (*CreateStep) Op ¶
func (s *CreateStep) Op() StepOp
func (*CreateStep) Provider ¶
func (s *CreateStep) Provider() string
func (*CreateStep) Res ¶
func (s *CreateStep) Res() *resource.State
func (*CreateStep) Type ¶
func (s *CreateStep) Type() tokens.Type
func (*CreateStep) URN ¶
func (s *CreateStep) URN() resource.URN
type DeleteStep ¶
type DeleteStep struct {
// contains filtered or unexported fields
}
DeleteStep is a mutating step that deletes an existing resource. If `old` is marked "External", DeleteStep is a no-op.
func (*DeleteStep) Apply ¶
func (s *DeleteStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
func (*DeleteStep) Deployment ¶ added in v2.15.0
func (s *DeleteStep) Deployment() *Deployment
func (*DeleteStep) Logical ¶
func (s *DeleteStep) Logical() bool
func (*DeleteStep) New ¶
func (s *DeleteStep) New() *resource.State
func (*DeleteStep) Old ¶
func (s *DeleteStep) Old() *resource.State
func (*DeleteStep) Op ¶
func (s *DeleteStep) Op() StepOp
func (*DeleteStep) Provider ¶
func (s *DeleteStep) Provider() string
func (*DeleteStep) Res ¶
func (s *DeleteStep) Res() *resource.State
func (*DeleteStep) Type ¶
func (s *DeleteStep) Type() tokens.Type
func (*DeleteStep) URN ¶
func (s *DeleteStep) URN() resource.URN
type Deployment ¶ added in v2.15.0
type Deployment struct {
// contains filtered or unexported fields
}
A Deployment manages the iterative computation and execution of a deployment based on a stream of goal states. A running deployment emits events that indicate its progress. These events must be used to record the new state of the deployment target.
func NewDeployment ¶ added in v2.15.0
func NewDeployment(ctx *plugin.Context, target *Target, prev *Snapshot, source Source, localPolicyPackPaths []string, preview bool, backendClient BackendClient) (*Deployment, error)
NewDeployment creates a new deployment from a resource snapshot plus a package to evaluate.
From the old and new states, it understands how to orchestrate an evaluation and analyze the resulting resources. The deployment may be used to simply inspect a series of operations, or actually perform them; these operations are generated based on analysis of the old and new states. If a resource exists in new, but not old, for example, it results in a create; if it exists in both, but is different, it results in an update; and so on and so forth.
Note that a deployment uses internal concurrency and parallelism in various ways, so it must be closed if for some reason it isn't carried out to its final conclusion. This will result in cancellation and reclamation of resources.
func NewImportDeployment ¶ added in v2.15.0
func NewImportDeployment(ctx *plugin.Context, target *Target, projectName tokens.PackageName, imports []Import, preview bool) (*Deployment, error)
NewImportDeployment creates a new import deployment from a resource snapshot plus a set of resources to import.
From the old and new states, it understands how to orchestrate an evaluation and analyze the resulting resources. The deployment may be used to simply inspect a series of operations, or actually perform them; these operations are generated based on analysis of the old and new states. If a resource exists in new, but not old, for example, it results in a create; if it exists in both, but is different, it results in an update; and so on and so forth.
Note that a deployment uses internal concurrency and parallelism in various ways, so it must be closed if for some reason it isn't carried out to its final conclusion. This will result in cancellation and reclamation of resources.
func (*Deployment) Ctx ¶ added in v2.15.0
func (d *Deployment) Ctx() *plugin.Context
func (*Deployment) Diag ¶ added in v2.15.0
func (d *Deployment) Diag() diag.Sink
func (*Deployment) Execute ¶ added in v2.15.0
Execute executes a deployment to completion, using the given cancellation context and running a preview or update.
func (*Deployment) GetProvider ¶ added in v2.15.0
func (*Deployment) Olds ¶ added in v2.15.0
func (d *Deployment) Olds() map[resource.URN]*resource.State
func (*Deployment) Prev ¶ added in v2.15.0
func (d *Deployment) Prev() *Snapshot
func (*Deployment) Source ¶ added in v2.15.0
func (d *Deployment) Source() Source
func (*Deployment) Target ¶ added in v2.15.0
func (d *Deployment) Target() *Target
type EvalRunInfo ¶
type EvalRunInfo struct { Proj *workspace.Project `json:"proj" yaml:"proj"` // the package metadata. Pwd string `json:"pwd" yaml:"pwd"` // the package's working directory. Program string `json:"program" yaml:"program"` // the path to the program. Args []string `json:"args,omitempty" yaml:"args,omitempty"` // any arguments to pass to the package. Target *Target `json:"target,omitempty" yaml:"target,omitempty"` // the target being deployed into. }
EvalRunInfo provides information required to execute and deploy resources within a package.
type Events ¶
type Events interface { StepExecutorEvents PolicyEvents }
Events is an interface that can be used to hook interesting engine events.
type Import ¶ added in v2.12.0
type Import struct { Type tokens.Type // The type token for the resource. Required. Name tokens.QName // The name of the resource. Required. ID resource.ID // The ID of the resource. Required. Parent resource.URN // The parent of the resource, if any. Provider resource.URN // The specific provider to use for the resource, if any. Version *semver.Version // The provider version to use for the resource, if any. Protect bool // Whether to mark the resource as protected after import }
An Import specifies a resource to import.
type ImportOptions ¶ added in v2.12.0
type ImportOptions struct { Events Events // an optional events callback interface. Parallel int // the degree of parallelism for resource operations (<=1 for serial). }
ImportOptions controls the import process.
type ImportStep ¶
type ImportStep struct {
// contains filtered or unexported fields
}
func (*ImportStep) Apply ¶
func (s *ImportStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
func (*ImportStep) Deployment ¶ added in v2.15.0
func (s *ImportStep) Deployment() *Deployment
func (*ImportStep) DetailedDiff ¶
func (s *ImportStep) DetailedDiff() map[string]plugin.PropertyDiff
func (*ImportStep) Diffs ¶
func (s *ImportStep) Diffs() []resource.PropertyKey
func (*ImportStep) Logical ¶
func (s *ImportStep) Logical() bool
func (*ImportStep) New ¶
func (s *ImportStep) New() *resource.State
func (*ImportStep) Old ¶
func (s *ImportStep) Old() *resource.State
func (*ImportStep) Op ¶
func (s *ImportStep) Op() StepOp
func (*ImportStep) Provider ¶
func (s *ImportStep) Provider() string
func (*ImportStep) Res ¶
func (s *ImportStep) Res() *resource.State
func (*ImportStep) Type ¶
func (s *ImportStep) Type() tokens.Type
func (*ImportStep) URN ¶
func (s *ImportStep) URN() resource.URN
type Manifest ¶
type Manifest struct { Time time.Time // the time this snapshot was taken. Magic string // a magic cookie. Version string // the pulumi command version. Plugins []workspace.PluginInfo // the plugin versions also loaded. }
Manifest captures versions for all binaries used to construct this snapshot.
type Options ¶
type Options struct { Events Events // an optional events callback interface. Parallel int // the degree of parallelism for resource operations (<=1 for serial). Refresh bool // whether or not to refresh before executing the deployment. RefreshOnly bool // whether or not to exit after refreshing. RefreshTargets []resource.URN // The specific resources to refresh during a refresh op. ReplaceTargets []resource.URN // Specific resources to replace. DestroyTargets []resource.URN // Specific resources to destroy. UpdateTargets []resource.URN // Specific resources to update. TargetDependents bool // true if we're allowing things to proceed, even with unspecified targets TrustDependencies bool // whether or not to trust the resource dependency graph. UseLegacyDiff bool // whether or not to use legacy diffing behavior. DisableResourceReferences bool // true to disable resource reference support. }
Options controls the deployment process.
func (Options) DegreeOfParallelism ¶
DegreeOfParallelism returns the degree of parallelism that should be used during the deployment process.
func (Options) InfiniteParallelism ¶
InfiniteParallelism returns whether or not the requested level of parallelism is unbounded.
type PlanPendingOperationsError ¶
PlanPendingOperationsError is an error returned from `NewPlan` if there exist pending operations in the snapshot that we are preparing to operate upon. The engine does not allow any operations to be pending when operating on a snapshot.
func (PlanPendingOperationsError) Error ¶
func (p PlanPendingOperationsError) Error() string
type PolicyEvents ¶
type PolicyEvents interface {
OnPolicyViolation(resource.URN, plugin.AnalyzeDiagnostic)
}
PolicyEvents is an interface that can be used to hook policy events.
type ProviderSource ¶
type ProviderSource interface { // GetProvider fetches the provider plugin for the given reference. GetProvider(ref providers.Reference) (plugin.Provider, bool) }
A ProviderSource allows a Source to lookup provider plugins.
type QuerySource ¶
QuerySource is used to synchronously wait for a query result.
func NewQuerySource ¶
func NewQuerySource(cancel context.Context, plugctx *plugin.Context, client BackendClient, runinfo *EvalRunInfo, defaultProviderVersions map[tokens.Package]*semver.Version, provs ProviderSource) (QuerySource, error)
NewQuerySource creates a `QuerySource` for some target runtime environment specified by `runinfo`, and supported by language plugins provided in `plugctx`.
type ReadResourceEvent ¶
type ReadResourceEvent interface { SourceEvent // ID is the requested ID of this read. ID() resource.ID // Name is the requested name of this read. Name() tokens.QName // Type is type of the resource being read. Type() tokens.Type // Provider is a reference to the provider instance to use for this read. Provider() string // Parent is the parent resource of the resource being read. Parent() resource.URN // Properties is the property bag that will be passed to Read as search parameters. Properties() resource.PropertyMap // Dependencies returns the list of URNs upon which this read depends. Dependencies() []resource.URN // Done indicates that we are done with this event. Done(result *ReadResult) // The names of any additional outputs that should be treated as secrets. AdditionalSecretOutputs() []resource.PropertyKey }
ReadResourceEvent is an event that asks the engine to read the state of an existing resource.
type ReadResult ¶
type ReadStep ¶
type ReadStep struct {
// contains filtered or unexported fields
}
ReadStep is a step indicating that an existing resources will be "read" and projected into the Pulumi object model. Resources that are read are marked with the "External" bit which indicates to the engine that it does not own this resource's lifeycle.
A resource with a given URN can transition freely between an "external" state and a non-external state. If a URN that was previously marked "External" (i.e. was the target of a ReadStep in a previous deployment) is the target of a RegisterResource in the next deployment, a CreateReplacement step will be issued to indicate the transition from external to owned. If a URN that was previously not marked "External" is the target of a ReadResource in the next deployment, a ReadReplacement step will be issued to indicate the transition from owned to external.
func (*ReadStep) Deployment ¶ added in v2.15.0
func (s *ReadStep) Deployment() *Deployment
type RefreshStep ¶
type RefreshStep struct {
// contains filtered or unexported fields
}
RefreshStep is a step used to track the progress of a refresh operation. A refresh operation updates the an existing resource by reading its current state from its provider plugin. These steps are not issued by the step generator; instead, they are issued by the deployment executor as the optional first step in deployment execution.
func (*RefreshStep) Apply ¶
func (s *RefreshStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
func (*RefreshStep) Deployment ¶ added in v2.15.0
func (s *RefreshStep) Deployment() *Deployment
func (*RefreshStep) Logical ¶
func (s *RefreshStep) Logical() bool
func (*RefreshStep) New ¶
func (s *RefreshStep) New() *resource.State
func (*RefreshStep) Old ¶
func (s *RefreshStep) Old() *resource.State
func (*RefreshStep) Op ¶
func (s *RefreshStep) Op() StepOp
func (*RefreshStep) Provider ¶
func (s *RefreshStep) Provider() string
func (*RefreshStep) Res ¶
func (s *RefreshStep) Res() *resource.State
func (*RefreshStep) ResultOp ¶
func (s *RefreshStep) ResultOp() StepOp
ResultOp returns the operation that corresponds to the change to this resource after reading its current state, if any.
func (*RefreshStep) Type ¶
func (s *RefreshStep) Type() tokens.Type
func (*RefreshStep) URN ¶
func (s *RefreshStep) URN() resource.URN
type RegisterResourceEvent ¶
type RegisterResourceEvent interface { SourceEvent // Goal returns the goal state for the resource object that was allocated by the program. Goal() *resource.Goal // Done indicates that we are done with this step. It must be called to perform cleanup associated with the step. Done(result *RegisterResult) }
RegisterResourceEvent is a step that asks the engine to provision a resource.
type RegisterResourceOutputsEvent ¶
type RegisterResourceOutputsEvent interface { SourceEvent // URN is the resource URN that this completion applies to. URN() resource.URN // Outputs returns a property map of output properties to add to a resource before completing. Outputs() resource.PropertyMap // Done indicates that we are done with this step. It must be called to perform cleanup associated with the step. Done() }
RegisterResourceOutputsEvent is an event that asks the engine to complete the provisioning of a resource.
type RegisterResult ¶
RegisterResult is the state of the resource after it has been registered.
type RemovePendingReplaceStep ¶
type RemovePendingReplaceStep struct {
// contains filtered or unexported fields
}
func (*RemovePendingReplaceStep) Apply ¶
func (s *RemovePendingReplaceStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
func (*RemovePendingReplaceStep) Deployment ¶ added in v2.15.0
func (s *RemovePendingReplaceStep) Deployment() *Deployment
func (*RemovePendingReplaceStep) Logical ¶
func (s *RemovePendingReplaceStep) Logical() bool
func (*RemovePendingReplaceStep) New ¶
func (s *RemovePendingReplaceStep) New() *resource.State
func (*RemovePendingReplaceStep) Old ¶
func (s *RemovePendingReplaceStep) Old() *resource.State
func (*RemovePendingReplaceStep) Op ¶
func (s *RemovePendingReplaceStep) Op() StepOp
func (*RemovePendingReplaceStep) Provider ¶
func (s *RemovePendingReplaceStep) Provider() string
func (*RemovePendingReplaceStep) Res ¶
func (s *RemovePendingReplaceStep) Res() *resource.State
func (*RemovePendingReplaceStep) Type ¶
func (s *RemovePendingReplaceStep) Type() tokens.Type
func (*RemovePendingReplaceStep) URN ¶
func (s *RemovePendingReplaceStep) URN() resource.URN
type ReplaceStep ¶
type ReplaceStep struct {
// contains filtered or unexported fields
}
ReplaceStep is a logical step indicating a resource will be replaced. This is comprised of three physical steps: a creation of the new resource, any number of intervening updates of dependents to the new resource, and then a deletion of the now-replaced old resource. This logical step is primarily here for tools and visualization.
func (*ReplaceStep) Apply ¶
func (s *ReplaceStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
func (*ReplaceStep) Deployment ¶ added in v2.15.0
func (s *ReplaceStep) Deployment() *Deployment
func (*ReplaceStep) DetailedDiff ¶
func (s *ReplaceStep) DetailedDiff() map[string]plugin.PropertyDiff
func (*ReplaceStep) Diffs ¶
func (s *ReplaceStep) Diffs() []resource.PropertyKey
func (*ReplaceStep) Keys ¶
func (s *ReplaceStep) Keys() []resource.PropertyKey
func (*ReplaceStep) Logical ¶
func (s *ReplaceStep) Logical() bool
func (*ReplaceStep) New ¶
func (s *ReplaceStep) New() *resource.State
func (*ReplaceStep) Old ¶
func (s *ReplaceStep) Old() *resource.State
func (*ReplaceStep) Op ¶
func (s *ReplaceStep) Op() StepOp
func (*ReplaceStep) Provider ¶
func (s *ReplaceStep) Provider() string
func (*ReplaceStep) Res ¶
func (s *ReplaceStep) Res() *resource.State
func (*ReplaceStep) Type ¶
func (s *ReplaceStep) Type() tokens.Type
func (*ReplaceStep) URN ¶
func (s *ReplaceStep) URN() resource.URN
type SameStep ¶
type SameStep struct {
// contains filtered or unexported fields
}
SameStep is a mutating step that does nothing.
func (*SameStep) Deployment ¶ added in v2.15.0
func (s *SameStep) Deployment() *Deployment
func (*SameStep) IsSkippedCreate ¶
type Snapshot ¶
type Snapshot struct { Manifest Manifest // a deployment manifest of versions, checksums, and so on. SecretsManager secrets.Manager // the manager to use use when seralizing this snapshot. Resources []*resource.State // fetches all resources and their associated states. PendingOperations []resource.Operation // all currently pending resource operations. }
Snapshot is a view of a collection of resources in an stack at a point in time. It describes resources; their IDs, names, and properties; their dependencies; and more. A snapshot is a diffable entity and can be used to create or apply an infrastructure deployment plan in order to make reality match the snapshot state.
func NewSnapshot ¶
func NewSnapshot(manifest Manifest, secretsManager secrets.Manager, resources []*resource.State, ops []resource.Operation) *Snapshot
NewSnapshot creates a snapshot from the given arguments. The resources must be in topologically sorted order. This property is not checked; for verification, please refer to the VerifyIntegrity function below.
func (*Snapshot) NormalizeURNReferences ¶
NormalizeURNReferences fixes up all URN references in a snapshot to use the new URNs instead of potentially-aliased URNs. This will affect resources that are "old", and which would be expected to be updated to refer to the new names later in the deployment. But until they are, we still want to ensure that any serialization of the snapshot uses URN references which do not need to be indirected through any alias lookups, and which instead refer directly to the URN of a resource in the resources map.
Note: This method modifies the snapshot (and resource.States in the snapshot) in-place.
func (*Snapshot) VerifyIntegrity ¶
VerifyIntegrity checks a snapshot to ensure it is well-formed. Because of the cost of this operation, integrity verification is only performed on demand, and not automatically during snapshot construction.
This function verifies a number of invariants:
- Provider resources must be referenceable (i.e. they must have a valid URN and ID)
- A resource's provider must precede the resource in the resource list
- Parents must precede children in the resource list
- Dependents must precede their dependencies in the resource list
- For every URN in the snapshot, there must be at most one resource with that URN that is not pending deletion
- The magic manifest number should change every time the snapshot is mutated
type Source ¶
type Source interface { io.Closer // Project returns the package name of the Pulumi project we are obtaining resources from. Project() tokens.PackageName // Info returns a serializable payload that can be used to stamp snapshots for future reconciliation. Info() interface{} // Iterate begins iterating the source. Error is non-nil upon failure; otherwise, a valid iterator is returned. Iterate(ctx context.Context, opts Options, providers ProviderSource) (SourceIterator, result.Result) }
A Source can generate a new set of resources that the planner will process accordingly.
var NullSource Source = &nullSource{}
NullSource is a singleton source that never returns any resources. This may be used in scenarios where the "new" version of the world is meant to be empty, either for testing purposes, or removal of an existing stack.
func NewErrorSource ¶
func NewErrorSource(project tokens.PackageName) Source
func NewEvalSource ¶
func NewEvalSource(plugctx *plugin.Context, runinfo *EvalRunInfo, defaultProviderVersions map[tokens.Package]*semver.Version, dryRun bool) Source
NewEvalSource returns a planning source that fetches resources by evaluating a package with a set of args and a confgiuration map. This evaluation is performed using the given plugin context and may optionally use the given plugin host (or the default, if this is nil). Note that closing the eval source also closes the host.
func NewFixedSource ¶
func NewFixedSource(ctx tokens.PackageName, steps []SourceEvent) Source
NewFixedSource returns a valid planning source that is comprised of a list of pre-computed steps.
type SourceEvent ¶
type SourceEvent interface {
// contains filtered or unexported methods
}
SourceEvent is an event associated with the enumeration of a plan. It is an intent expressed by the source program, and it is the responsibility of the engine to make it so.
type SourceIterator ¶
type SourceIterator interface { io.Closer // Next returns the next event from the source. Next() (SourceEvent, result.Result) }
A SourceIterator enumerates the list of resources that a source has to offer and tracks associated state.
type SourceResourceMonitor ¶
type SourceResourceMonitor interface { Address() string Cancel() error Invoke(ctx context.Context, req *pulumirpc.InvokeRequest) (*pulumirpc.InvokeResponse, error) ReadResource(ctx context.Context, req *pulumirpc.ReadResourceRequest) (*pulumirpc.ReadResourceResponse, error) RegisterResource(ctx context.Context, req *pulumirpc.RegisterResourceRequest) (*pulumirpc.RegisterResourceResponse, error) RegisterResourceOutputs(ctx context.Context, req *pulumirpc.RegisterResourceOutputsRequest) (*pbempty.Empty, error) }
SourceResourceMonitor directs resource operations from the `Source` to various resource providers.
type Step ¶
type Step interface { // Apply applies or previews this step. It returns the status of the resource after the step application, // a function to call to signal that this step has fully completed, and an error, if one occurred while applying // the step. // // The returned StepCompleteFunc, if not nil, must be called after committing the results of this step into // the state of the deployment. Apply(preview bool) (resource.Status, StepCompleteFunc, error) // applies or previews this step. Op() StepOp // the operation performed by this step. URN() resource.URN // the resource URN (for before and after). Type() tokens.Type // the type affected by this step. Provider() string // the provider reference for this step. Old() *resource.State // the state of the resource before performing this step. New() *resource.State // the state of the resource after performing this step. Res() *resource.State // the latest state for the resource that is known (worst case, old). Logical() bool // true if this step represents a logical operation in the program. Deployment() *Deployment // the owning deployment. }
Step is a specification for a deployment operation.
func NewCreateReplacementStep ¶
func NewCreateReplacementStep(deployment *Deployment, reg RegisterResourceEvent, old, new *resource.State, keys, diffs []resource.PropertyKey, detailedDiff map[string]plugin.PropertyDiff, pendingDelete bool) Step
func NewCreateStep ¶
func NewCreateStep(deployment *Deployment, reg RegisterResourceEvent, new *resource.State) Step
func NewDeleteReplacementStep ¶
func NewDeleteReplacementStep(deployment *Deployment, old *resource.State, pendingReplace bool) Step
func NewDeleteStep ¶
func NewDeleteStep(deployment *Deployment, old *resource.State) Step
func NewImportReplacementStep ¶
func NewImportReplacementStep(deployment *Deployment, reg RegisterResourceEvent, original, new *resource.State, ignoreChanges []string) Step
func NewImportStep ¶
func NewImportStep(deployment *Deployment, reg RegisterResourceEvent, new *resource.State, ignoreChanges []string) Step
func NewReadReplacementStep ¶
func NewReadReplacementStep(deployment *Deployment, event ReadResourceEvent, old, new *resource.State) Step
NewReadReplacementStep creates a new Read step with the `replacing` flag set. When executed, it will pend deletion of the "old" resource, which must not be an external resource.
func NewReadStep ¶
func NewReadStep(deployment *Deployment, event ReadResourceEvent, old, new *resource.State) Step
NewReadStep creates a new Read step.
func NewRefreshStep ¶
func NewRefreshStep(deployment *Deployment, old *resource.State, done chan<- bool) Step
NewRefreshStep creates a new Refresh step.
func NewRemovePendingReplaceStep ¶
func NewRemovePendingReplaceStep(deployment *Deployment, old *resource.State) Step
func NewReplaceStep ¶
func NewReplaceStep(deployment *Deployment, old, new *resource.State, keys, diffs []resource.PropertyKey, detailedDiff map[string]plugin.PropertyDiff, pendingDelete bool) Step
func NewSameStep ¶
func NewSameStep(deployment *Deployment, reg RegisterResourceEvent, old, new *resource.State) Step
func NewSkippedCreateStep ¶
func NewSkippedCreateStep(deployment *Deployment, reg RegisterResourceEvent, new *resource.State) Step
NewSkippedCreateStep produces a SameStep for a resource that was created but not targeted by the user (and thus was skipped). These act as no-op steps (hence 'same') since we are not actually creating the resource, but ensure that we complete resource-registration and convey the right information downstream. For example, we will not write these into the checkpoint file.
func NewUpdateStep ¶
func NewUpdateStep(deployment *Deployment, reg RegisterResourceEvent, old, new *resource.State, stables, diffs []resource.PropertyKey, detailedDiff map[string]plugin.PropertyDiff, ignoreChanges []string) Step
type StepCompleteFunc ¶
type StepCompleteFunc func()
StepCompleteFunc is the type of functions returned from Step.Apply. These functions are to be called when the engine has fully retired a step.
type StepExecutorEvents ¶
type StepExecutorEvents interface { OnResourceStepPre(step Step) (interface{}, error) OnResourceStepPost(ctx interface{}, step Step, status resource.Status, err error) error OnResourceOutputs(step Step) error }
StepExecutorEvents is an interface that can be used to hook resource lifecycle events.
type StepOp ¶
type StepOp string
StepOp represents the kind of operation performed by a step. It evaluates to its string label.
const ( OpSame StepOp = "same" // nothing to do. OpCreate StepOp = "create" // creating a new resource. OpUpdate StepOp = "update" // updating an existing resource. OpDelete StepOp = "delete" // deleting an existing resource. OpReplace StepOp = "replace" // replacing a resource with a new one. OpCreateReplacement StepOp = "create-replacement" // creating a new resource for a replacement. OpDeleteReplaced StepOp = "delete-replaced" // deleting an existing resource after replacement. OpRead StepOp = "read" // reading an existing resource. OpReadReplacement StepOp = "read-replacement" // reading an existing resource for a replacement. OpRefresh StepOp = "refresh" // refreshing an existing resource. OpReadDiscard StepOp = "discard" // removing a resource that was read. OpDiscardReplaced StepOp = "discard-replaced" // discarding a read resource that was replaced. OpRemovePendingReplace StepOp = "remove-pending-replace" // removing a pending replace resource. OpImport StepOp = "import" // import an existing resource. OpImportReplacement StepOp = "import-replacement" // replace an existing resource with an imported resource. )
type Target ¶
type Target struct { Name tokens.QName // the target stack name. Config config.Map // optional configuration key/value pairs. Decrypter config.Decrypter // decrypter for secret configuration values. Snapshot *Snapshot // the last snapshot deployed to the target. }
Target represents information about a deployment target.
func (*Target) GetPackageConfig ¶
GetPackageConfig returns the set of configuration parameters for the indicated package, if any.
type UpdateStep ¶
type UpdateStep struct {
// contains filtered or unexported fields
}
UpdateStep is a mutating step that updates an existing resource's state.
func (*UpdateStep) Apply ¶
func (s *UpdateStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error)
func (*UpdateStep) Deployment ¶ added in v2.15.0
func (s *UpdateStep) Deployment() *Deployment
func (*UpdateStep) DetailedDiff ¶
func (s *UpdateStep) DetailedDiff() map[string]plugin.PropertyDiff
func (*UpdateStep) Diffs ¶
func (s *UpdateStep) Diffs() []resource.PropertyKey
func (*UpdateStep) Logical ¶
func (s *UpdateStep) Logical() bool
func (*UpdateStep) New ¶
func (s *UpdateStep) New() *resource.State
func (*UpdateStep) Old ¶
func (s *UpdateStep) Old() *resource.State
func (*UpdateStep) Op ¶
func (s *UpdateStep) Op() StepOp
func (*UpdateStep) Provider ¶
func (s *UpdateStep) Provider() string
func (*UpdateStep) Res ¶
func (s *UpdateStep) Res() *resource.State
func (*UpdateStep) Type ¶
func (s *UpdateStep) Type() tokens.Type
func (*UpdateStep) URN ¶
func (s *UpdateStep) URN() resource.URN
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package providers contains the logic for managing provider resources (versioning, loading, resource operations).
|
Package providers contains the logic for managing provider resources (versioning, loading, resource operations). |