stack

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: Apache-2.0 Imports: 18 Imported by: 19

Documentation

Overview

Package stack contains the serialized and configurable state associated with an stack; or, in other words, a deployment target. It pertains to resources and deployment plans, but is a package unto itself.

Index

Constants

View Source
const (
	// DeploymentSchemaVersionOldestSupported is the oldest deployment schema that we
	// still support, i.e. we can produce a `deploy.Snapshot` from. This will generally
	// need to be at least one less than the current schema version so that old deployments can
	// be migrated to the current schema.
	DeploymentSchemaVersionOldestSupported = 1
)

Variables

View Source
var (
	// ErrDeploymentSchemaVersionTooOld is returned from `DeserializeDeployment` if the
	// untyped deployment being deserialized is too old to understand.
	ErrDeploymentSchemaVersionTooOld = fmt.Errorf("this stack's deployment is too old")

	// ErrDeploymentSchemaVersionTooNew is returned from `DeserializeDeployment` if the
	// untyped deployment being deserialized is too new to understand.
	ErrDeploymentSchemaVersionTooNew = fmt.Errorf("this stack's deployment version is too new")
)

Functions

func DeserializeCheckpoint

func DeserializeCheckpoint(chkpoint *apitype.CheckpointV3) (*deploy.Snapshot, error)

DeserializeCheckpoint takes a serialized deployment record and returns its associated snapshot. Returns nil if there have been no deployments performed on this checkpoint.

func DeserializeDeploymentV3

func DeserializeDeploymentV3(deployment apitype.DeploymentV3, secretsProv SecretsProvider) (*deploy.Snapshot, error)

DeserializeDeploymentV3 deserializes a typed DeploymentV3 into a `deploy.Snapshot`.

func DeserializeOperation

func DeserializeOperation(op apitype.OperationV2, dec config.Decrypter) (resource.Operation, error)

func DeserializeProperties

func DeserializeProperties(props map[string]interface{}, dec config.Decrypter) (resource.PropertyMap, error)

DeserializeProperties deserializes an entire map of deploy properties into a resource property map.

func DeserializePropertyValue

func DeserializePropertyValue(v interface{}, dec config.Decrypter) (resource.PropertyValue, error)

DeserializePropertyValue deserializes a single deploy property into a resource property value.

func DeserializeResource

func DeserializeResource(res apitype.ResourceV3, dec config.Decrypter) (*resource.State, error)

DeserializeResource turns a serialized resource back into its usual form.

func DeserializeUntypedDeployment

func DeserializeUntypedDeployment(
	deployment *apitype.UntypedDeployment, secretsProv SecretsProvider) (*deploy.Snapshot, error)

DeserializeUntypedDeployment deserializes an untyped deployment and produces a `deploy.Snapshot` from it. DeserializeDeployment will return an error if the untyped deployment's version is not within the range `DeploymentSchemaVersionCurrent` and `DeploymentSchemaVersionOldestSupported`.

func GetRootStackResource

func GetRootStackResource(snap *deploy.Snapshot) (*resource.State, error)

GetRootStackResource returns the root stack resource from a given snapshot, or nil if not found.

func NewCachingSecretsManager

func NewCachingSecretsManager(manager secrets.Manager) secrets.Manager

NewCachingSecretsManager returns a new secrets.Manager that caches the ciphertext for secret property values. A secrets.Manager that will be used to encrypt and decrypt values stored in a serialized deployment can be wrapped in a caching secrets manager in order to avoid re-encrypting secrets each time the deployment is serialized.

func SerializeCheckpoint

func SerializeCheckpoint(stack tokens.QName, snap *deploy.Snapshot,
	sm secrets.Manager) (*apitype.VersionedCheckpoint, error)

SerializeCheckpoint turns a snapshot into a data structure suitable for serialization.

func SerializeDeployment

func SerializeDeployment(snap *deploy.Snapshot, sm secrets.Manager) (*apitype.DeploymentV3, error)

SerializeDeployment serializes an entire snapshot as a deploy record.

func SerializeOperation

func SerializeOperation(op resource.Operation, enc config.Encrypter) (apitype.OperationV2, error)

func SerializeProperties

func SerializeProperties(props resource.PropertyMap, enc config.Encrypter) (map[string]interface{}, error)

SerializeProperties serializes a resource property bag so that it's suitable for serialization.

func SerializePropertyValue

func SerializePropertyValue(prop resource.PropertyValue, enc config.Encrypter) (interface{}, error)

SerializePropertyValue serializes a resource property value so that it's suitable for serialization.

func SerializeResource

func SerializeResource(res *resource.State, enc config.Encrypter) (apitype.ResourceV3, error)

SerializeResource turns a resource into a structure suitable for serialization.

func UnmarshalVersionedCheckpointToLatestCheckpoint

func UnmarshalVersionedCheckpointToLatestCheckpoint(bytes []byte) (*apitype.CheckpointV3, error)

Types

type SecretsProvider

type SecretsProvider interface {
	// OfType returns a secrets manager for the given type, initialized with its previous state.
	OfType(ty string, state json.RawMessage) (secrets.Manager, error)
}

SecretsProvider allows for the creation of secrets managers based on a well-known type name.

var DefaultSecretsProvider SecretsProvider = &defaultSecretsProvider{}

DefaultSecretsProvider is the default SecretsProvider to use when deserializing deployments.

Jump to

Keyboard shortcuts

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