backend

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: Apache-2.0 Imports: 32 Imported by: 30

Documentation

Overview

Package backend encapsulates all extensibility points required to fully implement a new cloud provider.

Index

Constants

View Source
const (
	// GitHead is the commit hash of HEAD.
	GitHead = "git.head"
	// GitHeadName is the name of the HEAD ref. e.g. "refs/heads/master" or "refs/tags/v1.0.0".
	GitHeadName = "git.headName"
	// GitDirty ("true", "false") indicates if there are any unstaged or modified files in the local repo.
	GitDirty = "git.dirty"

	// GitCommitter is the name of the person who committed the commit at HEAD.
	GitCommitter = "git.committer"
	// GitCommitterEmail is the Email address associated with the committer.
	GitCommitterEmail = "git.committer.email"
	// GitAuthor is the name of the person who authored the commit at HEAD.
	GitAuthor = "git.author"
	// GitAuthorEmail is the email address associated with the commit's author.
	GitAuthorEmail = "git.author.email"

	// VCSRepoOwner is the user who owns the local repo, if the origin remote is a cloud host.
	VCSRepoOwner = "vcs.owner"
	// VCSRepoName is the name of the repo, if the local git repo's remote origin is a cloud host.
	VCSRepoName = "vcs.repo"
	//VCSRepoKind is the cloud host where the repo is hosted.
	VCSRepoKind = "vcs.kind"

	// CISystem is the name of the CI system running the pulumi operation.
	CISystem = "ci.system"
	// CIBuildID is an opaque ID of the build in the CI system.
	CIBuildID = "ci.build.id"
	// CIBuildType is the type of build of the CI system, e.g. "push", "pull_request", "test_only".
	CIBuildType = "ci.build.type"
	// CIBuildURL is a URL to get more information about the particular CI build.
	CIBuildURL = "ci.build.url"

	// CIPRHeadSHA is the SHA of the HEAD commit of a pull request running on CI. This is needed since the CI
	// server will run at a different, merge commit. (headSHA merged into the target branch.)
	CIPRHeadSHA = "ci.pr.headSHA"
	// CIPRNumber is the PR number, for which the current CI job may be executing.
	// Combining this information with the `VCSRepoKind` will give us the PR URL.
	CIPRNumber = "ci.pr.number"
)

Keys we use for values put into UpdateInfo.Environment.

Variables

View Source
var (
	// ErrNoPreviousDeployment is returned when there isn't a previous deployment.
	ErrNoPreviousDeployment = errors.New("no previous deployment")
)

Functions

func ActionLabel added in v0.15.1

func ActionLabel(kind apitype.UpdateKind, dryRun bool) string

func DestroyStack

DestroyStack destroys all of this stack's resources.

func ExportStackDeployment

func ExportStackDeployment(ctx context.Context, s Stack) (*apitype.UntypedDeployment, error)

ExportStackDeployment exports the given stack's deployment as an opaque JSON message.

func GetEnvironmentTagsForCurrentStack added in v0.16.10

func GetEnvironmentTagsForCurrentStack() (map[apitype.StackTagName]string, error)

GetEnvironmentTagsForCurrentStack returns the set of tags for the "current" stack, based on the environment and Pulumi.yaml file.

func GetLatestConfiguration

func GetLatestConfiguration(ctx context.Context, s Stack) (config.Map, error)

GetLatestConfiguration returns the configuration for the most recent deployment of the stack.

func GetMergedStackTags added in v0.16.10

func GetMergedStackTags(ctx context.Context, s Stack) (map[apitype.StackTagName]string, error)

GetMergedStackTags returns the stack's existing tags merged with fresh tags from the environment and Pulumi.yaml file.

func GetStackLogs

func GetStackLogs(ctx context.Context, s Stack, cfg StackConfiguration,
	query operations.LogQuery) ([]operations.LogEntry, error)

GetStackLogs fetches a list of log entries for the current stack in the current backend.

func GetStackTags

func GetStackTags(ctx context.Context, s Stack) (map[apitype.StackTagName]string, error)

GetStackTags fetches the stack's existing tags.

func ImportStackDeployment

func ImportStackDeployment(ctx context.Context, s Stack, deployment *apitype.UntypedDeployment) error

ImportStackDeployment imports the given deployment into the indicated stack.

func NewBackendClient added in v0.16.6

func NewBackendClient(backend Backend) deploy.BackendClient

NewBackendClient returns a deploy.BackendClient that wraps the given Backend.

func PreviewStack

PreviewStack previews changes to this stack.

func PreviewThenPrompt added in v0.15.1

func PreviewThenPrompt(ctx context.Context, kind apitype.UpdateKind, stack Stack,
	op UpdateOperation, apply Applier) (engine.ResourceChanges, result.Result)

func PreviewThenPromptThenExecute added in v0.15.1

func PreviewThenPromptThenExecute(ctx context.Context, kind apitype.UpdateKind, stack Stack,
	op UpdateOperation, apply Applier) (engine.ResourceChanges, result.Result)

func Query added in v0.17.11

Query executes a query program against a stack's resource outputs.

func RefreshStack

RefreshStack refresh's the stack's state from the cloud provider.

func RemoveStack

func RemoveStack(ctx context.Context, s Stack, force bool) (bool, error)

RemoveStack returns the stack, or returns an error if it cannot.

func RenameStack added in v0.17.3

func RenameStack(ctx context.Context, s Stack, newName tokens.QName) error

func UpdateStack

UpdateStack updates the target stack with the current workspace's contents (config and code).

func UpdateStackTags added in v0.16.10

func UpdateStackTags(ctx context.Context, s Stack, tags map[apitype.StackTagName]string) error

UpdateStackTags updates the stacks's tags, replacing all existing tags.

Types

type Applier added in v0.15.1

type Applier func(ctx context.Context, kind apitype.UpdateKind, stack Stack, op UpdateOperation,
	opts ApplierOptions, events chan<- engine.Event) (engine.ResourceChanges, result.Result)

Applier applies the changes specified by this update operation against the target stack.

type ApplierOptions added in v0.16.0

type ApplierOptions struct {
	// DryRun indicates if the update should not change any resource state and instead just preview changes.
	DryRun bool
	// ShowLink indicates if a link to the update persisted result should be displayed.
	ShowLink bool
}

ApplierOptions is a bag of configuration settings for an Applier.

type ApplyOperation added in v0.17.23

type ApplyOperation struct {
	Version int
	Scopes  CancellationScopeSource
}

ApplyOperation publishes a PolicyPack to the backend.

type Backend

type Backend interface {
	// Name returns a friendly name for this backend.
	Name() string
	// URL returns a URL at which information about this backend may be seen.
	URL() string

	// GetPolicyPack returns a PolicyPack object tied to this backend, or nil if it cannot be found.
	GetPolicyPack(ctx context.Context, policyPack string, d diag.Sink) (PolicyPack, error)

	// SupportsOrganizations tells whether a user can belong to multiple organizations in this backend.
	SupportsOrganizations() bool
	// ParseStackReference takes a string representation and parses it to a reference which may be used for other
	// methods in this backend.
	ParseStackReference(s string) (StackReference, error)

	// DoesProjectExist returns true if a project with the given name exists in this backend, or false otherwise.
	DoesProjectExist(ctx context.Context, projectName string) (bool, error)

	// GetStack returns a stack object tied to this backend with the given name, or nil if it cannot be found.
	GetStack(ctx context.Context, stackRef StackReference) (Stack, error)
	// CreateStack creates a new stack with the given name and options that are specific to the backend provider.
	CreateStack(ctx context.Context, stackRef StackReference, opts interface{}) (Stack, error)
	// RemoveStack removes a stack with the given name.  If force is true, the stack will be removed even if it
	// still contains resources.  Otherwise, if the stack contains resources, a non-nil error is returned, and the
	// first boolean return value will be set to true.
	RemoveStack(ctx context.Context, stackRef StackReference, force bool) (bool, error)
	// ListStacks returns a list of stack summaries for all known stacks in the target backend.
	ListStacks(ctx context.Context, filter ListStacksFilter) ([]StackSummary, error)

	RenameStack(ctx context.Context, stackRef StackReference, newName tokens.QName) error

	// Preview shows what would be updated given the current workspace's contents.
	Preview(ctx context.Context, stackRef StackReference, op UpdateOperation) (engine.ResourceChanges, result.Result)
	// Update updates the target stack with the current workspace's contents (config and code).
	Update(ctx context.Context, stackRef StackReference, op UpdateOperation) (engine.ResourceChanges, result.Result)
	// Refresh refreshes the stack's state from the cloud provider.
	Refresh(ctx context.Context, stackRef StackReference, op UpdateOperation) (engine.ResourceChanges, result.Result)
	// Destroy destroys all of this stack's resources.
	Destroy(ctx context.Context, stackRef StackReference, op UpdateOperation) (engine.ResourceChanges, result.Result)

	// Query against the resource outputs in a stack's state checkpoint.
	Query(ctx context.Context, stackRef StackReference, op UpdateOperation) result.Result

	// GetHistory returns all updates for the stack. The returned UpdateInfo slice will be in
	// descending order (newest first).
	GetHistory(ctx context.Context, stackRef StackReference) ([]UpdateInfo, error)
	// GetLogs fetches a list of log entries for the given stack, with optional filtering/querying.
	GetLogs(ctx context.Context, stackRef StackReference, cfg StackConfiguration,
		query operations.LogQuery) ([]operations.LogEntry, error)
	// Get the configuration from the most recent deployment of the stack.
	GetLatestConfiguration(ctx context.Context, stackRef StackReference) (config.Map, error)

	// GetStackTags fetches the stack's existing tags.
	GetStackTags(ctx context.Context, stackRef StackReference) (map[apitype.StackTagName]string, error)
	// UpdateStackTags updates the stacks's tags, replacing all existing tags.
	UpdateStackTags(ctx context.Context, stackRef StackReference, tags map[apitype.StackTagName]string) error

	// ExportDeployment exports the deployment for the given stack as an opaque JSON message.
	ExportDeployment(ctx context.Context, stackRef StackReference) (*apitype.UntypedDeployment, error)
	// ImportDeployment imports the given deployment into the indicated stack.
	ImportDeployment(ctx context.Context, stackRef StackReference, deployment *apitype.UntypedDeployment) error
	// Logout logs you out of the backend and removes any stored credentials.
	Logout() error
	// Returns the identity of the current user for the backend.
	CurrentUser() (string, error)
}

Backend is an interface that represents actions the engine will interact with to manage stacks of cloud resources. It can be implemented any number of ways to provide pluggable backend implementations of the Pulumi Cloud.

type CancellationScope

type CancellationScope interface {
	// Context returns the cancellation context used to observe cancellation and termination requests for this scope.
	Context() *cancel.Context
	// Close closes the cancellation scope.
	Close()
}

CancellationScope provides a scoped source of cancellation and termination requests.

type CancellationScopeSource

type CancellationScopeSource interface {
	// NewScope creates a new cancellation scope.
	NewScope(events chan<- engine.Event, isPreview bool) CancellationScope
}

CancellationScopeSource provides a source for cancellation scopes.

type ConflictingUpdateError added in v1.1.0

type ConflictingUpdateError struct {
	Err error // The error that occurred while starting the operation.
}

ConflictingUpdateError represents an error which occurred while starting an update/destroy operation. Another update of the same stack was in progress, so the operation got cancelled due to this conflict.

func (ConflictingUpdateError) Error added in v1.1.0

func (c ConflictingUpdateError) Error() string

type ListStacksFilter added in v1.0.0

type ListStacksFilter struct {
	Organization *string
	Project      *string
	TagName      *string
	TagValue     *string
}

ListStacksFilter describes optional filters when listing stacks.

type MockBackend added in v1.0.0

type MockBackend struct {
	NameF                   func() string
	URLF                    func() string
	GetPolicyPackF          func(ctx context.Context, policyPack string, d diag.Sink) (PolicyPack, error)
	SupportsOrganizationsF  func() bool
	ParseStackReferenceF    func(s string) (StackReference, error)
	DoesProjectExistF       func(context.Context, string) (bool, error)
	GetStackF               func(context.Context, StackReference) (Stack, error)
	CreateStackF            func(context.Context, StackReference, interface{}) (Stack, error)
	RemoveStackF            func(context.Context, StackReference, bool) (bool, error)
	ListStacksF             func(context.Context, ListStacksFilter) ([]StackSummary, error)
	RenameStackF            func(context.Context, StackReference, tokens.QName) error
	GetStackCrypterF        func(StackReference) (config.Crypter, error)
	QueryF                  func(context.Context, StackReference, UpdateOperation) result.Result
	GetLatestConfigurationF func(context.Context, StackReference) (config.Map, error)
	GetHistoryF             func(context.Context, StackReference) ([]UpdateInfo, error)
	GetStackTagsF           func(context.Context, StackReference) (map[apitype.StackTagName]string, error)
	UpdateStackTagsF        func(context.Context, StackReference, map[apitype.StackTagName]string) error
	ExportDeploymentF       func(context.Context, StackReference) (*apitype.UntypedDeployment, error)
	ImportDeploymentF       func(context.Context, StackReference, *apitype.UntypedDeployment) error
	LogoutF                 func() error
	CurrentUserF            func() (string, error)
	PreviewF                func(context.Context, StackReference,
		UpdateOperation) (engine.ResourceChanges, result.Result)
	UpdateF func(context.Context, StackReference,
		UpdateOperation) (engine.ResourceChanges, result.Result)
	RefreshF func(context.Context, StackReference,
		UpdateOperation) (engine.ResourceChanges, result.Result)
	DestroyF func(context.Context, StackReference,
		UpdateOperation) (engine.ResourceChanges, result.Result)
	GetLogsF func(context.Context, StackReference, StackConfiguration,
		operations.LogQuery) ([]operations.LogEntry, error)
}

func (*MockBackend) CreateStack added in v1.0.0

func (be *MockBackend) CreateStack(ctx context.Context, stackRef StackReference, opts interface{}) (Stack, error)

func (*MockBackend) CurrentUser added in v1.0.0

func (be *MockBackend) CurrentUser() (string, error)

func (*MockBackend) Destroy added in v1.0.0

func (*MockBackend) DoesProjectExist added in v1.0.0

func (be *MockBackend) DoesProjectExist(ctx context.Context, projectName string) (bool, error)

func (*MockBackend) ExportDeployment added in v1.0.0

func (be *MockBackend) ExportDeployment(ctx context.Context,
	stackRef StackReference) (*apitype.UntypedDeployment, error)

func (*MockBackend) GetHistory added in v1.0.0

func (be *MockBackend) GetHistory(ctx context.Context, stackRef StackReference) ([]UpdateInfo, error)

func (*MockBackend) GetLatestConfiguration added in v1.0.0

func (be *MockBackend) GetLatestConfiguration(ctx context.Context,
	stackRef StackReference) (config.Map, error)

func (*MockBackend) GetLogs added in v1.0.0

func (*MockBackend) GetPolicyPack added in v1.0.0

func (be *MockBackend) GetPolicyPack(
	ctx context.Context, policyPack string, d diag.Sink) (PolicyPack, error)

func (*MockBackend) GetStack added in v1.0.0

func (be *MockBackend) GetStack(ctx context.Context, stackRef StackReference) (Stack, error)

func (*MockBackend) GetStackCrypter added in v1.0.0

func (be *MockBackend) GetStackCrypter(stackRef StackReference) (config.Crypter, error)

func (*MockBackend) GetStackTags added in v1.0.0

func (be *MockBackend) GetStackTags(ctx context.Context,
	stackRef StackReference) (map[apitype.StackTagName]string, error)

func (*MockBackend) ImportDeployment added in v1.0.0

func (be *MockBackend) ImportDeployment(ctx context.Context, stackRef StackReference,
	deployment *apitype.UntypedDeployment) error

func (*MockBackend) ListStacks added in v1.0.0

func (be *MockBackend) ListStacks(ctx context.Context, filter ListStacksFilter) ([]StackSummary, error)

func (*MockBackend) Logout added in v1.0.0

func (be *MockBackend) Logout() error

func (*MockBackend) Name added in v1.0.0

func (be *MockBackend) Name() string

func (*MockBackend) ParseStackReference added in v1.0.0

func (be *MockBackend) ParseStackReference(s string) (StackReference, error)

func (*MockBackend) Preview added in v1.0.0

func (*MockBackend) Query added in v1.0.0

func (be *MockBackend) Query(ctx context.Context, stackRef StackReference,
	op UpdateOperation) result.Result

func (*MockBackend) Refresh added in v1.0.0

func (*MockBackend) RemoveStack added in v1.0.0

func (be *MockBackend) RemoveStack(ctx context.Context, stackRef StackReference, force bool) (bool, error)

func (*MockBackend) RenameStack added in v1.0.0

func (be *MockBackend) RenameStack(ctx context.Context, stackRef StackReference, newName tokens.QName) error

func (*MockBackend) SupportsOrganizations added in v1.0.0

func (be *MockBackend) SupportsOrganizations() bool

func (*MockBackend) URL added in v1.0.0

func (be *MockBackend) URL() string

func (*MockBackend) Update added in v1.0.0

func (*MockBackend) UpdateStackTags added in v1.0.0

func (be *MockBackend) UpdateStackTags(ctx context.Context, stackRef StackReference,
	tags map[apitype.StackTagName]string) error

type MockStack added in v1.0.0

type MockStack struct {
	RefF      func() StackReference
	ConfigF   func() config.Map
	SnapshotF func(ctx context.Context) (*deploy.Snapshot, error)
	BackendF  func() Backend
	PreviewF  func(ctx context.Context, op UpdateOperation) (engine.ResourceChanges, result.Result)
	UpdateF   func(ctx context.Context, op UpdateOperation) (engine.ResourceChanges, result.Result)
	RefreshF  func(ctx context.Context, op UpdateOperation) (engine.ResourceChanges, result.Result)
	DestroyF  func(ctx context.Context, op UpdateOperation) (engine.ResourceChanges, result.Result)
	QueryF    func(ctx context.Context, op UpdateOperation) result.Result
	RemoveF   func(ctx context.Context, force bool) (bool, error)
	RenameF   func(ctx context.Context, newName tokens.QName) error
	GetLogsF  func(ctx context.Context, cfg StackConfiguration,
		query operations.LogQuery) ([]operations.LogEntry, error)
	ExportDeploymentF func(ctx context.Context) (*apitype.UntypedDeployment, error)
	ImportDeploymentF func(ctx context.Context, deployment *apitype.UntypedDeployment) error
}

func (*MockStack) Backend added in v1.0.0

func (ms *MockStack) Backend() Backend

func (*MockStack) Config added in v1.0.0

func (ms *MockStack) Config() config.Map

func (*MockStack) Destroy added in v1.0.0

func (*MockStack) ExportDeployment added in v1.0.0

func (ms *MockStack) ExportDeployment(ctx context.Context) (*apitype.UntypedDeployment, error)

func (*MockStack) GetLogs added in v1.0.0

func (*MockStack) ImportDeployment added in v1.0.0

func (ms *MockStack) ImportDeployment(ctx context.Context, deployment *apitype.UntypedDeployment) error

func (*MockStack) Preview added in v1.0.0

func (*MockStack) Query added in v1.0.0

func (*MockStack) Ref added in v1.0.0

func (ms *MockStack) Ref() StackReference

func (*MockStack) Refresh added in v1.0.0

func (*MockStack) Remove added in v1.0.0

func (ms *MockStack) Remove(ctx context.Context, force bool) (bool, error)

func (*MockStack) Rename added in v1.0.0

func (ms *MockStack) Rename(ctx context.Context, newName tokens.QName) error

func (*MockStack) Snapshot added in v1.0.0

func (ms *MockStack) Snapshot(ctx context.Context) (*deploy.Snapshot, error)

func (*MockStack) Update added in v1.0.0

type PolicyPack added in v0.17.23

type PolicyPack interface {
	// Ref returns a reference to this PolicyPack.
	Ref() PolicyPackReference
	// Backend returns the backend this PolicyPack is managed by.
	Backend() Backend
	// Publish the PolicyPack to the service.
	Publish(ctx context.Context, op PublishOperation) result.Result
	// Apply the PolicyPack to an organization.
	Apply(ctx context.Context, op ApplyOperation) error
}

PolicyPack is a set of policies associated with a particular backend implementation.

type PolicyPackReference added in v0.17.23

type PolicyPackReference interface {
	// fmt.Stringer's String() method returns a string of the stack identity, suitable for display in the CLI
	fmt.Stringer
	// OrgName is the name of the organization that is managing the PolicyPack.
	OrgName() string
	// Name is the name of the PolicyPack being referenced.
	Name() tokens.QName
}

PolicyPackReference is an opaque type that refers to a PolicyPack managed by a backend. The CLI uses the ParsePolicyPackReference method to turn a string like "myOrg/mySecurityRules" into a PolicyPackReference that can be used to interact with the PolicyPack via the backend. PolicyPackReferences are specific to a given backend and different back ends may interpret the string passed to ParsePolicyPackReference differently.

type PublishOperation added in v0.17.23

type PublishOperation struct {
	Root    string
	PlugCtx *plugin.Context
	Scopes  CancellationScopeSource
}

PublishOperation publishes a PolicyPack to the backend.

type SnapshotManager

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

SnapshotManager is an implementation of engine.SnapshotManager that inspects steps and performs mutations on the global snapshot object serially. This implementation maintains two bits of state: the "base" snapshot, which is completely immutable and represents the state of the world prior to the application of the current plan, and a "new" list of resources, which consists of the resources that were operated upon by the current plan.

Important to note is that, although this SnapshotManager is designed to be easily convertible into a thread-safe implementation, the code as it is today is *not thread safe*. In particular, it is not legal for there to be more than one `SnapshotMutation` active at any point in time. This is because this SnapshotManager invalidates the last persisted snapshot in `BeginSnapshot`. This is designed to match existing behavior and will not be the state of things going forward.

The resources stored in the `resources` slice are pointers to resource objects allocated by the engine. This is subtle and a little confusing. The reason for this is that the engine directly mutates resource objects that it creates and expects those mutations to be persisted directly to the snapshot.

func NewSnapshotManager

func NewSnapshotManager(persister SnapshotPersister, baseSnap *deploy.Snapshot) *SnapshotManager

NewSnapshotManager creates a new SnapshotManager for the given stack name, using the given persister and base snapshot.

It is *very important* that the baseSnap pointer refers to the same Snapshot given to the engine! The engine will mutate this object and correctness of the SnapshotManager depends on being able to observe this mutation. (This is not ideal...)

func (*SnapshotManager) BeginMutation

func (sm *SnapshotManager) BeginMutation(step deploy.Step) (engine.SnapshotMutation, error)

BeginMutation signals to the SnapshotManager that the engine intends to mutate the global snapshot by performing the given Step. This function gives the SnapshotManager a chance to record the intent to mutate before the mutation occurs.

func (*SnapshotManager) Close

func (sm *SnapshotManager) Close() error

func (*SnapshotManager) RegisterResourceOutputs

func (sm *SnapshotManager) RegisterResourceOutputs(step deploy.Step) error

RegisterResourceOutputs handles the registering of outputs on a Step that has already completed. This is accomplished by doing an in-place mutation of the resources currently resident in the snapshot.

Due to the way this is currently implemented, the engine directly mutates output properties on the resource State object that it created. Since we are storing pointers to these objects in the `resources` slice, we need only to do a no-op mutation in order to flush these new mutations to disk.

Note that this is completely not thread-safe and defeats the purpose of having a `mutate` callback entirely, but the hope is that this state of things will not be permament.

type SnapshotPersister

type SnapshotPersister interface {
	// Persists the given snapshot. Returns an error if the persistence failed.
	Save(snapshot *deploy.Snapshot) error
	// Gets the secrets manager used by this persister.
	SecretsManager() secrets.Manager
}

SnapshotPersister is an interface implemented by our backends that implements snapshot persistence. In order to fit into our current model, snapshot persisters have two functions: saving snapshots and invalidating already-persisted snapshots.

type Stack

type Stack interface {
	Ref() StackReference                                    // this stack's identity.
	Snapshot(ctx context.Context) (*deploy.Snapshot, error) // the latest deployment snapshot.
	Backend() Backend                                       // the backend this stack belongs to.

	// Preview changes to this stack.
	Preview(ctx context.Context, op UpdateOperation) (engine.ResourceChanges, result.Result)
	// Update this stack.
	Update(ctx context.Context, op UpdateOperation) (engine.ResourceChanges, result.Result)
	// Refresh this stack's state from the cloud provider.
	Refresh(ctx context.Context, op UpdateOperation) (engine.ResourceChanges, result.Result)
	// Destroy this stack's resources.
	Destroy(ctx context.Context, op UpdateOperation) (engine.ResourceChanges, result.Result)

	// Query this stack's state.
	Query(ctx context.Context, op UpdateOperation) result.Result
	// remove this stack.
	Remove(ctx context.Context, force bool) (bool, error)
	// rename this stack.
	Rename(ctx context.Context, newName tokens.QName) error
	// list log entries for this stack.
	GetLogs(ctx context.Context, cfg StackConfiguration, query operations.LogQuery) ([]operations.LogEntry, error)
	// export this stack's deployment.
	ExportDeployment(ctx context.Context) (*apitype.UntypedDeployment, error)
	// import the given deployment into this stack.
	ImportDeployment(ctx context.Context, deployment *apitype.UntypedDeployment) error
}

Stack is a stack associated with a particular backend implementation.

type StackAlreadyExistsError

type StackAlreadyExistsError struct {
	StackName string
}

StackAlreadyExistsError is returned from CreateStack when the stack already exists in the backend.

func (StackAlreadyExistsError) Error

func (e StackAlreadyExistsError) Error() string

type StackConfiguration added in v0.17.11

type StackConfiguration struct {
	Config    config.Map
	Decrypter config.Decrypter
}

StackConfiguration holds the configuration for a stack and it's associated decrypter.

type StackReference

type StackReference interface {
	// fmt.Stringer's String() method returns a string of the stack identity, suitable for display in the CLI
	fmt.Stringer
	// Name is the name that will be passed to the Pulumi engine when preforming operations on this stack. This
	// name may not uniquely identify the stack (e.g. the cloud backend embeds owner information in the StackReference
	// but that information is not part of the StackName() we pass to the engine.
	Name() tokens.QName
}

StackReference is an opaque type that refers to a stack managed by a backend. The CLI uses the ParseStackReference method to turn a string like "my-great-stack" or "pulumi/my-great-stack" into a stack reference that can be used to interact with the stack via the backend. Stack references are specific to a given backend and different back ends may interpret the string passed to ParseStackReference differently

type StackSummary added in v0.15.3

type StackSummary interface {
	Name() StackReference

	// LastUpdate returns when the stack was last updated, as applicable.
	LastUpdate() *time.Time
	// ResourceCount returns the stack's resource count, as applicable.
	ResourceCount() *int
}

StackSummary provides a basic description of a stack, without the ability to inspect its resources or make changes.

type UpdateInfo

type UpdateInfo struct {
	// Information known before an update is started.
	Kind      apitype.UpdateKind `json:"kind"`
	StartTime int64              `json:"startTime"`

	// Message is an optional message associated with the update.
	Message string `json:"message"`

	// Environment contains optional data from the deploying environment. e.g. the current
	// source code control commit information.
	Environment map[string]string `json:"environment"`

	// Config used for the update.
	Config config.Map `json:"config"`

	// Information obtained from an update completing.
	Result          UpdateResult           `json:"result"`
	EndTime         int64                  `json:"endTime"`
	ResourceChanges engine.ResourceChanges `json:"resourceChanges,omitempty"`
}

UpdateInfo describes a previous update.

type UpdateMetadata

type UpdateMetadata struct {
	// Message is an optional message associated with the update.
	Message string `json:"message"`
	// Environment contains optional data from the deploying environment. e.g. the current
	// source code control commit information.
	Environment map[string]string `json:"environment"`
}

UpdateMetadata describes optional metadata about an update.

type UpdateOperation added in v0.15.1

type UpdateOperation struct {
	Proj               *workspace.Project
	Root               string
	M                  *UpdateMetadata
	Opts               UpdateOptions
	SecretsManager     secrets.Manager
	StackConfiguration StackConfiguration
	Scopes             CancellationScopeSource
}

UpdateOperation is a complete stack update operation (preview, update, refresh, or destroy).

type UpdateOptions

type UpdateOptions struct {
	// Engine contains all of the engine-specific options.
	Engine engine.UpdateOptions
	// Display contains all of the backend display options.
	Display display.Options

	// AutoApprove, when true, will automatically approve previews.
	AutoApprove bool
	// SkipPreview, when true, causes the preview step to be skipped.
	SkipPreview bool
}

UpdateOptions is the full set of update options, including backend and engine options.

type UpdateResult

type UpdateResult string

UpdateResult is an enum for the result of the update.

const (
	// InProgressResult is for updates that have not yet completed.
	InProgressResult UpdateResult = "in-progress"
	// SucceededResult is for updates that completed successfully.
	SucceededResult UpdateResult = "succeeded"
	// FailedResult is for updates that have failed.
	FailedResult UpdateResult = "failed"
)

Directories

Path Synopsis
nolint: goconst
nolint: goconst

Jump to

Keyboard shortcuts

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