Documentation
¶
Index ¶
- Constants
- Variables
- func GroupOrderedElementsForRemoval(orderedElements []*ElementWithAllDeps) [][]state.Element
- func GroupOrderedNodes(orderedNodes []*DeploymentNode, refChainCollector refgraph.RefChainCollector) ([][]*DeploymentNode, error)
- func PopulateDirectDependencies(ctx context.Context, allNodes []*DeploymentNode, ...) error
- func PopulateResourceSpecDefaults(ctx context.Context, blueprint *schema.Blueprint, params core.BlueprintParams, ...) (*schema.Blueprint, error)
- type BlueprintContainer
- type BlueprintContainerDependencies
- type BlueprintDestroyer
- type BlueprintPrepareResult
- type BlueprintPreparer
- type ChangeStagingChannels
- type ChangeStagingState
- type ChangeStagingStateFactory
- type ChildBlueprintDeployer
- type ChildBlueprintDestroyer
- type ChildBlueprintIDInfo
- type ChildBlueprintLoaderFactory
- type ChildChangeStager
- type ChildChangesMessage
- type ChildDeployUpdateMessage
- type ChildInstanceInfo
- type CollectedElements
- type CollectedResourceData
- type DependenciesOverrider
- type DeployChannels
- type DeployContext
- func DeployContextWithChannels(deployCtx *DeployContext, channels *DeployChannels) *DeployContext
- func DeployContextWithGroup(deployCtx *DeployContext, groupIndex int) *DeployContext
- func DeployContextWithInstanceSnapshot(deployCtx *DeployContext, instanceSnapshot *state.InstanceState) *DeployContext
- func DeployContextWithLogger(deployCtx *DeployContext, logger core.Logger) *DeployContext
- type DeployEvent
- type DeployInput
- type DeploymentFinishedMessage
- type DeploymentNode
- type DeploymentNodeType
- type DeploymentState
- type DeploymentStateFactory
- type DeploymentUpdateMessage
- type DestroyInput
- type ElementWithAllDeps
- type EventType
- type ExpandedResourceTemplateResult
- type IncludeSubstitutionResolver
- type LinkChangeStager
- type LinkChangesMessage
- type LinkDeployResult
- type LinkDeployUpdateMessage
- type LinkDeployer
- type LinkDestroyer
- type LinkIDInfo
- type LinkPendingCompletion
- type Loader
- type LoaderOption
- func WithLoaderChangeStagingStateFactory(changeStagingStateFactory ChangeStagingStateFactory) LoaderOption
- func WithLoaderChildBlueprintDestroyer(childBlueprintDestroyer ChildBlueprintDestroyer) LoaderOption
- func WithLoaderClock(clock bpcore.Clock) LoaderOption
- func WithLoaderDataSourceRegistry(dataSourceRegistry provider.DataSourceRegistry) LoaderOption
- func WithLoaderDefaultRetryPolicy(retryPolicy *provider.RetryPolicy) LoaderOption
- func WithLoaderDependenciesOverrider(overrider DependenciesOverrider) LoaderOption
- func WithLoaderDeploymentStateFactory(deploymentStateFactory DeploymentStateFactory) LoaderOption
- func WithLoaderDerivedFromTemplates(derivedFromTemplates []string) LoaderOption
- func WithLoaderDriftCheckEnabled(driftCheckEnabled bool) LoaderOption
- func WithLoaderDriftChecker(driftChecker drift.Checker) LoaderOption
- func WithLoaderFunctionRegistry(funcRegistry provider.FunctionRegistry) LoaderOption
- func WithLoaderIDGenerator(idGenerator bpcore.IDGenerator) LoaderOption
- func WithLoaderLinkDeployer(linkDeployer LinkDeployer) LoaderOption
- func WithLoaderLinkDestroyer(linkDestroyer LinkDestroyer) LoaderOption
- func WithLoaderLinkRegistry(linkRegistry provider.LinkRegistry) LoaderOption
- func WithLoaderLogger(logger bpcore.Logger) LoaderOption
- func WithLoaderRefChainCollectorFactory(factory func() refgraph.RefChainCollector) LoaderOption
- func WithLoaderResolveWorkingDir(resolveWorkingDir corefunctions.WorkingDirResolver) LoaderOption
- func WithLoaderResourceDestroyer(resourceDestroyer ResourceDestroyer) LoaderOption
- func WithLoaderResourceRegistry(resourceRegistry resourcehelpers.Registry) LoaderOption
- func WithLoaderResourceStabilityPollingConfig(config *ResourceStabilityPollingConfig) LoaderOption
- func WithLoaderResourceTemplates(resourceTemplates map[string]string) LoaderOption
- func WithLoaderTransformSpec(transformSpec bool) LoaderOption
- func WithLoaderValidateAfterTransform(validateAfterTransform bool) LoaderOption
- func WithLoaderValidateRuntimeValues(validateRuntimeValues bool) LoaderOption
- type ResourceChangeStager
- type ResourceChangesMessage
- type ResourceDeployUpdateMessage
- type ResourceDeployer
- type ResourceDestroyer
- type ResourceIDInfo
- type ResourceStabilityPollingConfig
- type ResourceSubstitutionResolver
- type StageChangesInput
- type ValidationResult
Constants ¶
const ( // ErrorReasonCodeInvalidSpecExtension is provided // when the reason for a blueprint spec load error // is due to an invalid specification file extension. ErrorReasonCodeInvalidSpecExtension errors.ErrorReasonCode = "invalid_spec_ext" // ErrorReasonCodeInvalidResourceType is provided // when the reason for a blueprint spec load error // is due to an invalid resource type provided in one // of the resources in the spec. ErrorReasonCodeInvalidResourceType errors.ErrorReasonCode = "invalid_resource_type" // ErrorReasonCodeMissingProvider is provided when the // reason for a blueprint spec load error is due to // a missing provider for one of the resources in // the spec. ErrorReasonCodeMissingProvider errors.ErrorReasonCode = "missing_provider" // ErrorReasonCodeMissingResource is provided when the // reason for a blueprint spec load error is due to // the resource provider missing an implementation for the // resource type for one of the resources in the spec. ErrorReasonCodeMissingResource errors.ErrorReasonCode = "missing_resource" // ErrorReasonCodeResourceValidationErrors is provided // when the reason for a blueprint spec load error is due to // a collection of errors for one or more resources in the spec. // This should be used for a wrapper error that holds more specific // errors which can be used for reporting useful information // about issues with the spec. ErrorReasonCodeResourceValidationErrors errors.ErrorReasonCode = "resource_validation_errors" // ErrorReasonCodeDataSourceValidationErrors is provided // when the reason for a blueprint spec load error is due to // a collection of errors for one or more data sources in the spec. // This should be used for a wrapper error that holds more specific // errors which can be used for reporting useful information // about issues with the spec. ErrorReasonCodeDataSourceValidationErrors errors.ErrorReasonCode = "data_source_validation_errors" // ErrorReasonCodeResourceValidationErrors is provided // when the reason for a blueprint spec load error is due to // a collection of errors for one or more variables in the spec. // This should be used for a wrapper error that holds more specific // errors which can be used for reporting useful information // about issues with the spec. ErrorReasonCodeVariableValidationErrors errors.ErrorReasonCode = "variable_validation_errors" // ErrorReasonCodeIncludeValidationErrors is provided // when the reason for a blueprint spec load error is due to // a collection of errors for one or more includes in the spec. // This should be used for a wrapper error that holds more specific // errors which can be used for reporting useful information // about issues with the spec. ErrorReasonCodeIncludeValidationErrors errors.ErrorReasonCode = "include_validation_errors" // ErrorReasonCodeResourceValidationErrors is provided // when the reason for a blueprint spec load error is due to // a collection of errors for one or more variables in the spec. // This should be used for a wrapper error that holds more specific // errors which can be used for reporting useful information // about issues with the spec. ErrorReasonCodeExportValidationErrors errors.ErrorReasonCode = "export_validation_errors" // ErrorReasonMissingTransformers is provided when the // reason for a blueprint spec load error is due to a spec referencing // transformers that aren't supported by the blueprint loader // used to parse the schema. ErrorReasonMissingTransformers errors.ErrorReasonCode = "missing_transformers" )
const ( // ErrorReasonCodeMissingChildBlueprintPath // is provided when the reason for an error // during deployment or change staging is due to // a missing path to a child blueprint in an include. ErrorReasonCodeMissingChildBlueprintPath errors.ErrorReasonCode = "missing_child_blueprint_path" // ErrorReasonCodeEmptyChildBlueprintPath // is provided when the reason for an error // during deployment or change staging is due to // an empty path to a child blueprint in an include. ErrorReasonCodeEmptyChildBlueprintPath errors.ErrorReasonCode = "empty_child_blueprint_path" // ErrorReasonCodeResourceTemplateLinkLengthMismatch // is provided when the reason for an error // during deployment or change staging is due to // a mismatch in the length of the resolved items // for linked resource templates. ErrorReasonCodeResourceTemplateLinkLengthMismatch errors.ErrorReasonCode = "resource_template_link_length_mismatch" // ErrorReasonCodeBlueprintCycleDetected // is provided when the reason for an error // during deployment or change staging is due to // a cyclic blueprint inclusion detected. ErrorReasonCodeBlueprintCycleDetected errors.ErrorReasonCode = "blueprint_cycle_detected" // ErrorReasonCodeMaxBlueprintDepthExceeded // is provided when the reason for an error // during deployment or change staging is due to // the maximum blueprint depth being exceeded. ErrorReasonCodeMaxBlueprintDepthExceeded errors.ErrorReasonCode = "max_blueprint_depth_exceeded" // ErrorReasonCodeRemovedResourceHasDependents // is provided when the reason for an error // during deployment is due to a resource that is // to be removed having dependents that will not be // removed or recreated. ErrorReasonCodeRemovedResourceHasDependents errors.ErrorReasonCode = "removed_resource_has_dependents" // ErrorReasonCodeRemovedChildHasDependents // is provided when the reason for an error // during deployment is due to a child blueprint that is // to be removed having dependents that will not be // removed or recreated. ErrorReasonCodeRemovedChildHasDependents errors.ErrorReasonCode = "removed_child_has_dependents" // ErrorReasonCodeResourceNotFoundInState // is provided when the reason for an error // during deployment or change staging is due to // a resource not being found in the state of a blueprint instance. ErrorReasonCodeResourceNotFoundInState errors.ErrorReasonCode = "resource_not_found_in_state" // ErrorReasonCodeLinkNotFoundInState // is provided when the reason for an error // during deployment or change staging is due to // a link not being found in the state of a blueprint instance. ErrorReasonCodeLinkNotFoundInState errors.ErrorReasonCode = "link_not_found_in_state" // ErrorReasonCodeChildNotFoundInState // is provided when the reason for an error // during deployment or change staging is due to // a child not being found in the state of a blueprint instance. ErrorReasonCodeChildNotFoundInState errors.ErrorReasonCode = "child_not_found_in_state" // ErrorReasonCodeInvalidLogicalLinkName // is provided when the reason for an error // during deployment or change staging is due to // an invalid logical link name being provided when preparing to deploy // or destroy a link between resources. ErrorReasonCodeInvalidLogicalLinkName errors.ErrorReasonCode = "invalid_logical_link_name" // ErrorReasonCodeDeployMissingInstanceID // is provided when the reason for an error // during deployment is due to a missing instance ID // when deploying changes that modify existing resources or child blueprints. ErrorReasonCodeDeployMissingInstanceID errors.ErrorReasonCode = "deploy_missing_instance_id" // ErrorReasonCodeDeployMissingResourceChanges // is provided when the reason for an error // during deployment is due to missing changes for a resource // that is being deployed. ErrorReasonCodeDeployMissingResourceChanges errors.ErrorReasonCode = "deploy_missing_resource_changes" // ErrorReasonCodeDeployMissingPartiallyResolvedResource // is provided when the reason for an error // during deployment is due to a missing partially resolved resource // for a resource that is being deployed. ErrorReasonCodeDeployMissingPartiallyResolvedResource errors.ErrorReasonCode = "deploy_missing_partially_resolved_resource" // ErrorReasonCodeDriftDetected // is provided when the reason for an error // during deployment or change staging is due to // drift being detected in resources. ErrorReasonCodeDriftDetected errors.ErrorReasonCode = "drift_detected" // ErrorReasonCodeDeployInstanceIDAndNameProvided // is provided when the reason for an error // when destroying an instance or change staging is due to both an instance ID // and a name being provided. // This does not apply to deployments, for which an instance ID and name can be // provided and will both be used in the process of saving new blueprint instances. ErrorReasonCodeInstanceIDAndNameProvided errors.ErrorReasonCode = "instance_id_and_name_provided" // ErrorReasonCodeMissingNameForNewInstance // is provided when the reason for an error // during deployment is due to a missing name for a new instance // that is being created. // All blueprint instances require a user-defined name // (or one generated by the caller system based on its context). ErrorReasonCodeMissingNameForNewInstance errors.ErrorReasonCode = "missing_name_for_new_instance" // ErrorReasonCodeChildBlueprintError // is provided when the reason for an error // during deployment or change staging is due to // an error in a child blueprint. // This is used to wrap errors that occur in child blueprints // that are not run errors. ErrorReasonCodeChildBlueprintError errors.ErrorReasonCode = "child_blueprint_error" )
const MaxBlueprintDepth = 5
MaxBlueprintDepth is the maximum depth allowed for a tree of blueprints referenced by the use of the `include` feature in a blueprint. This means that if you have a dependency tree:
blueprint1 ├── blueprint2 │ ├── blueprint3 │ │ └── blueprint4
The depth of the the tree would be 4, therefore causing an error if MaxBlueprintDepth is set to 3.
This will also help with breaking out of cyclic blueprint inclusions. For example, if we have the following cycle and max depth is 3:
├── blueprint1 │ ├── blueprint2 │ │ ├── blueprint3 │ │ │ └── blueprint1
The iterations will be: 1. process blueprint1 2. process blueprint2 included in blueprint1 3. process blueprint3 included in blueprint2 4. Fail to due max depth reached.
Variables ¶
var DefaultResourceStabilityPollingConfig = &ResourceStabilityPollingConfig{ PollingInterval: 5 * time.Second, PollingTimeout: 30 * time.Minute, }
DefaultResourceStabilityPollingConfig is a reasonable default configuration for polling resources for stability.
Functions ¶
func GroupOrderedElementsForRemoval ¶
func GroupOrderedElementsForRemoval(orderedElements []*ElementWithAllDeps) [][]state.Element
GroupOrderedElements groups ordered elements for removal so that elements that are not related can be removed concurrently.
func GroupOrderedNodes ¶
func GroupOrderedNodes( orderedNodes []*DeploymentNode, refChainCollector refgraph.RefChainCollector, ) ([][]*DeploymentNode, error)
GroupOrderedNodes deals with grouping ordered deployment nodes for change staging and deployments to make the process more efficient by concurrently staging and deploying unrelated resources and child blueprints. The input is expected to be an ordered list of deployment nodes. The output is a list of groups of deployment nodes that can be staged or deployed concurrently, maintaining the order of the provided list for nodes that are connected.
func PopulateDirectDependencies ¶
func PopulateDirectDependencies( ctx context.Context, allNodes []*DeploymentNode, refChainCollector refgraph.RefChainCollector, params bpcore.BlueprintParams, ) error
PopulateDirectDependencies checks the relationships between deployment nodes and populates the dependencies between them. This should only need to be computed once per blueprint deployment where the dependency information can then be used to determine which elements to be deploy after others have completed. This only populates direct dependencies between nodes as the nodes are expected to be ordered and grouped in pools that also take transitive dependencies into account in the deployment process.
func PopulateResourceSpecDefaults ¶
func PopulateResourceSpecDefaults( ctx context.Context, blueprint *schema.Blueprint, params core.BlueprintParams, resourceRegistry resourcehelpers.Registry, ) (*schema.Blueprint, error)
PopulateResourceSpecDefaults populates the default values for missing values in each resource spec in the given blueprint.
Types ¶
type BlueprintContainer ¶
type BlueprintContainer interface {
// StageChanges deals with staging changes to be deployed, comparing the effect of applying
// the loaded blueprint to the existing instance stored in state for the instance ID it was
// loaded with.
// This will stream changes to the provided channels for each resource, child blueprint and link
// that will be affected by the changes, a final message will be sent to the complete channel
// containing the full set of changes that will be made to the blueprint instance when deploying
// the changes.
// Parameter overrides can be provided to add extra instance-specific variables
// that were not defined when the container was loaded or to provide all variables
// when the container was loaded with an empty set.
StageChanges(
ctx context.Context,
input *StageChangesInput,
channels *ChangeStagingChannels,
paramOverrides core.BlueprintParams,
) error
// Deploy deals with deploying the blueprint for the given instance ID.
// When an instance ID is omitted, the container will treat the deployment
// as a new instance of the blueprint where the provided change set only includes
// new resources, children and links.
// Deploying a blueprint involves creating, updating and destroying resources
// based on the staged changes.
// This will stream updates to the provided channels for each resource, child blueprint and link
// that has either been updated, created or removed.
// Deploy should also be used as the mechanism to rollback a blueprint to a previous
// revision managed in version control or a data store for blueprint source documents.
//
// There is synchronous and asynchronous error handling, synchronous errors will be returned
// during the initial setup phase of the deployment process.
// Most errors should be handled by the container and sent to the appropriate channel
// as a deployment update message.
Deploy(
ctx context.Context,
input *DeployInput,
channels *DeployChannels,
paramOverrides core.BlueprintParams,
) error
// Destroy deals with destroying all the resources, child blueprints and links
// for a blueprint instance.
// Like Deploy, Destroy requires changes to be staged and passed in to ensure that
// the user gets a chance to review everything that will be destroyed before
// starting the process; this should go hand and hand with a confirmation step and prompts
// to allow the user to dig deeper in the tools built on top of the framework.
// This will stream updates to the provided channels for each resource, child blueprint and link
// that has been removed.
//
// There is no synchronous error handling, all errors will be sent to the provided error
// channel. Most errors should be handled by the container and sent to the appropriate channel
// as an update message.
Destroy(
ctx context.Context,
input *DestroyInput,
channels *DeployChannels,
paramOverrides core.BlueprintParams,
)
// SpecLinkInfo provides the chain link and warnings for potential issues
// with links provided in the given specification.
SpecLinkInfo() links.SpecLinkInfo
// BlueprintSpec returns the specification for the loaded blueprint
// including the parsed schema and a convenience method to get resource
// schemas by name.
BlueprintSpec() speccore.BlueprintSpec
// RefChainCollector returns the reference chain collector used to collect
// reference chains for resources and child blueprints.
// This is useful for allowing parent contexts to get access to the collected
// references for a blueprint.
// For example, extracting the references from an expanded version of a blueprint
// that contains resource templates.
RefChainCollector() refgraph.RefChainCollector
// ResourceTemplates holds a mapping of resource names to the name of the resource
// template it was derived from.
// This allows retention of information about the original resource template
// that a resource was derived from in a source blueprint document.
ResourceTemplates() map[string]string
// Diagnostics returns warning and informational diagnostics for the loaded blueprint
// that point out potential issues that may occur when executing
// a blueprint.
// These diagnostics can contain errors, however, the error returned on failure to load a blueprint
// should also be unpacked to get the precise location and information about the reason loading the
// blueprint failed.
Diagnostics() []*core.Diagnostic
}
BlueprintContainer provides the interface for a service that manages staging and deploying an instance of a blueprint.
func NewDefaultBlueprintContainer ¶
func NewDefaultBlueprintContainer( spec speccore.BlueprintSpec, driftCheckEnabled bool, deps *BlueprintContainerDependencies, diagnostics []*core.Diagnostic, ) BlueprintContainer
NewDefaultBlueprintContainer creates a new instance of the default implementation of a blueprint container for a loaded spec. The map of resource providers must be a map of provider resource name to a provider.
type BlueprintContainerDependencies ¶
type BlueprintContainerDependencies struct {
StateContainer state.Container
Providers map[string]provider.Provider
ResourceRegistry resourcehelpers.Registry
LinkRegistry provider.LinkRegistry
LinkInfo links.SpecLinkInfo
ResourceTemplates map[string]string
RefChainCollector refgraph.RefChainCollector
SubstitutionResolver subengine.SubstitutionResolver
ChangeStager ResourceChangeStager
Clock core.Clock
IDGenerator core.IDGenerator
DeploymentStateFactory DeploymentStateFactory
ChangeStagingStateFactory ChangeStagingStateFactory
BlueprintPreparer BlueprintPreparer
LinkChangeStager LinkChangeStager
ChildChangeStager ChildChangeStager
ResourceDestroyer ResourceDestroyer
ChildBlueprintDestroyer ChildBlueprintDestroyer
LinkDestroyer LinkDestroyer
LinkDeployer LinkDeployer
DriftChecker drift.Checker
ResourceDeployer ResourceDeployer
ChildBlueprintDeployer ChildBlueprintDeployer
DefaultRetryPolicy *provider.RetryPolicy
Logger core.Logger
}
BlueprintContainerDependencies provides the dependencies required to create a new instance of a blueprint container.
type BlueprintDestroyer ¶
type BlueprintDestroyer interface {
Destroy(
ctx context.Context,
input *DestroyInput,
channels *DeployChannels,
paramOverrides core.BlueprintParams,
)
}
BlueprintDestroyer provides an interface for a service that will be used to destroy a blueprint instance. This is primarily useful for destroying child blueprints as part of the deployment process for a blueprint instance.
type BlueprintPrepareResult ¶
type BlueprintPrepareResult struct {
ResourceProviderMap map[string]provider.Provider
BlueprintContainer BlueprintContainer
ParallelGroups [][]*DeploymentNode
}
BlueprintPrepareResult contains the result of preparing a blueprint for deployment or change staging.
type BlueprintPreparer ¶
type BlueprintPreparer interface {
Prepare(
ctx context.Context,
blueprint *schema.Blueprint,
resolveFor subengine.ResolveForStage,
changes *changes.BlueprintChanges,
linkInfo links.SpecLinkInfo,
paramOverrides core.BlueprintParams,
) (*BlueprintPrepareResult, error)
}
BlueprintPreparer is an interface for a service that prepares a blueprint for deployment or change staging.
func NewDefaultBlueprintPreparer ¶
func NewDefaultBlueprintPreparer( providers map[string]provider.Provider, substitutionResolver subengine.SubstitutionResolver, resourceTemplateInputElemCache *core.Cache[[]*core.MappingNode], resourceRegistry resourcehelpers.Registry, resourceCache *core.Cache[*provider.ResolvedResource], childBlueprintLoaderFactory ChildBlueprintLoaderFactory, ) BlueprintPreparer
NewDefaultBlueprintPreparer creates a new instance of the default implementation of the service that prepares blueprints for deployment or change staging.
type ChangeStagingChannels ¶
type ChangeStagingChannels struct {
// ResourceChangesChan receives change sets for each resource in the blueprint.
ResourceChangesChan chan ResourceChangesMessage
// ChildChangesChan receives change sets for child blueprints once all
// changes for the child blueprint have been staged.
ChildChangesChan chan ChildChangesMessage
// LinkChangesChan receives change sets for links between resources.
LinkChangesChan chan LinkChangesMessage
// CompleteChan is used to signal that all changes have been staged
// containing the full set of changes that will be made to the blueprint instance
// when deploying the changes.
CompleteChan chan changes.BlueprintChanges
// ErrChan is used to signal that an error occurred while staging changes.
ErrChan chan error
}
ChangeStagingChannels contains all the channels required to stream change staging events.
type ChangeStagingState ¶
type ChangeStagingState interface {
// AddElementsThatMustBeRecreated adds elements that must be
// recreated due to removal of dependencies.
// This adds the elements to the existing set of elements that must be recreated
// and does not replace the existing set.
AddElementsThatMustBeRecreated(mustRecreate *CollectedElements)
// ApplyResourceChanges applies the changes for a given resource to the staging state.
ApplyResourceChanges(changes ResourceChangesMessage)
// UpdateLinkStagingState updates the staging state for links containing
// the resource represented by the provided ChainLinkNode.
UpdateLinkStagingState(node *links.ChainLinkNode) []*LinkPendingCompletion
// MustRecreateResourceOnRemovedDependencies returns true if the resource
// represented by the provided resource name must be recreated
// due to the removal of dependencies.
MustRecreateResourceOnRemovedDependencies(resourceName string) bool
// CountPendingLinksForGroup returns the number of pending links for the
// provided group of nodes for the current change staging operation.
CountPendingLinksForGroup(group []*DeploymentNode) int
// ApplyLinkChanges applies the changes for a given link to the staging state.
ApplyLinkChanges(changes LinkChangesMessage)
// ApplyChildChanges applies the changes for a given child blueprint
// to the staging state.
ApplyChildChanges(changes ChildChangesMessage)
// GetResourceChanges returns the changes for the provided resource name
// from the staging state.
// If no changes are found for the provided resource name, nil is returned.
GetResourceChanges(resourceName string) *provider.Changes
// MarkLinkAsNoLongerPending marks the link between the provided resource nodes
// as no longer pending in the staging state.
MarkLinkAsNoLongerPending(resourceANode, resourceBNode *links.ChainLinkNode)
// UpdateExportChanges updates the export changes in the staging state.
UpdateExportChanges(collectedExportChanges *changes.IntermediaryBlueprintChanges)
// UpdateMetadataChanges updates the blueprint-wide metadata changes in the staging state.
UpdateMetadataChanges(
changes *changes.MetadataChanges,
resolveOnDeploy []string,
)
// ExtractBlueprintChanges extracts the changes that have been staged
// for the deployment to be sent to the client initiating the change staging operation.
ExtractBlueprintChanges() changes.BlueprintChanges
}
ChangeStagingState provides functionality for tracking and setting the state when staging changes for a deployment. In most cases, this is to be treated as ephemeral state that lasts for the duration of a change staging operation.
func NewDefaultChangeStagingState ¶
func NewDefaultChangeStagingState() ChangeStagingState
NewDefaultChangeStagingState creates a new instance of the default implementation for tracking and setting the state of staging changes for a deployment. The default implementation is a thread-safe, ephemeral store for stage changing state.
type ChangeStagingStateFactory ¶
type ChangeStagingStateFactory func() ChangeStagingState
ChangeStagingStateFactory provides a factory function for creating a new instance of a change staging state that is used as an ephemeral store for tracking the state of a change staging operation.
type ChildBlueprintDeployer ¶
type ChildBlueprintDeployer interface {
Deploy(
ctx context.Context,
parentInstanceID string,
parentInstanceTreePath string,
includeTreePath string,
childNode *refgraph.ReferenceChainNode,
changes *changes.BlueprintChanges,
deployCtx *DeployContext,
)
}
ChildBlueprintDeployer provides an interface for a service that deploys a child blueprint as a part of the deployment process for a blueprint instance.
func NewDefaultChildBlueprintDeployer ¶
func NewDefaultChildBlueprintDeployer( substitutionResolver IncludeSubstitutionResolver, childResolver includes.ChildResolver, createChildBlueprintLoader ChildBlueprintLoaderFactory, stateContainer state.Container, ) ChildBlueprintDeployer
NewDefaultChildBlueprintDeployer creates a new instance of the default implementation of the service that deploys a child blueprint as a part of the deployment process for a blueprint instance.
type ChildBlueprintDestroyer ¶
type ChildBlueprintDestroyer interface {
Destroy(
ctx context.Context,
childBlueprintElement state.Element,
parentInstanceID string,
parentInstanceTreePath string,
includeTreePath string,
blueprintDestroyer BlueprintDestroyer,
deployCtx *DeployContext,
)
}
ChildBlueprintDestroyer provides an interface for a service that destroys a child blueprint as a part of the deployment process for a blueprint instance.
func NewDefaultChildBlueprintDestroyer ¶
func NewDefaultChildBlueprintDestroyer() ChildBlueprintDestroyer
NewDefaultChildBlueprintDestroyer creates a new instance of the default implementation of the service that destroys a child blueprint as a part of the deployment process for a blueprint instance.
type ChildBlueprintIDInfo ¶
ChildBlueprintIDInfo provides the globally unique ID and logical name of a child blueprint.
func (*ChildBlueprintIDInfo) ID ¶
func (r *ChildBlueprintIDInfo) ID() string
func (*ChildBlueprintIDInfo) Kind ¶
func (r *ChildBlueprintIDInfo) Kind() state.ElementKind
func (*ChildBlueprintIDInfo) LogicalName ¶
func (r *ChildBlueprintIDInfo) LogicalName() string
type ChildBlueprintLoaderFactory ¶
type ChildBlueprintLoaderFactory func( derivedFromTemplate []string, resourceTemplates map[string]string, ) Loader
ChildBlueprintLoaderFactory provides a factory function for creating a new loader for child or derived blueprints.
type ChildChangeStager ¶
type ChildChangeStager interface {
StageChanges(
ctx context.Context,
childInstanceInfo *ChildInstanceInfo,
node *refgraph.ReferenceChainNode,
paramOverrides core.BlueprintParams,
channels *ChangeStagingChannels,
logger core.Logger,
)
}
ChildChangeStager provides an interface for a service that stages changes for a child blueprint included in a parent blueprint.
func NewDefaultChildChangeStager ¶
func NewDefaultChildChangeStager( childResolver includes.ChildResolver, createChildBlueprintLoader ChildBlueprintLoaderFactory, stateContainer state.Container, childExportFieldCache *core.Cache[*subengine.ChildExportFieldInfo], substitutionResolver subengine.SubstitutionResolver, ) ChildChangeStager
NewDefaultLinkChangeStager creates a new instance of the default implementation of the service that stages changes for a child blueprint.
type ChildChangesMessage ¶
type ChildChangesMessage struct {
ChildBlueprintName string `json:"childBlueprintName"`
Removed bool `json:"removed"`
New bool `json:"new"`
Changes changes.BlueprintChanges `json:"changes"`
}
ChildChangesMessage provides a message containing the changes that will be made to a child blueprint in a blueprint instance.
type ChildDeployUpdateMessage ¶
type ChildDeployUpdateMessage struct {
// ParentInstanceID is the ID of the parent blueprint instance
// the message is associated with.
ParentInstanceID string `json:"parentInstanceId"`
// ChildInstanceID is the ID of the child blueprint instance
// the message is associated with.
ChildInstanceID string `json:"childInstanceId"`
// ChildName is the logical name of the child blueprint
// as defined in the source blueprint as an include.
ChildName string `json:"childName"`
// Group is the group number the child blueprint belongs to relative to the ordering
// for components in the current blueprint associated with the parent instance ID.
Group int `json:"group"`
// Status holds the status of the child blueprint.
Status core.InstanceStatus `json:"status"`
// FailureReasons holds a list of reasons why the child blueprint failed to deploy
// if the status update is for a failure.
FailureReasons []string `json:"failureReasons,omitempty"`
// UpdateTimestamp is the unix timestamp in seconds for
// when the status update occurred.
UpdateTimestamp int64 `json:"updateTimestamp"`
// Durations holds duration information for a child blueprint deployment.
// Duration information is attached on one of the following status updates:
// - InstanceStatusDeployed
// - InstanceStatusDeployFailed
// - InstanceStatusDestroyed
// - InstanceStatusUpdated
// - InstanceStatusUpdateFailed
Durations *state.InstanceCompletionDuration `json:"durations,omitempty"`
}
ChildDeployUpdateMessage provides a message containing status updates for child blueprints being deployed. Deployment messages report on status changes for child blueprints, the state of a child blueprint will need to be fetched from the state container to get further information about the state of the child blueprint.
type ChildInstanceInfo ¶
type ChildInstanceInfo struct {
ParentInstanceID string
ParentInstanceTreePath string
IncludeTreePath string
}
ChildInstanceInfo provides information about a child blueprint instance that is being deployed as part of a parent blueprint.
type CollectedElements ¶
type CollectedElements struct {
Resources []*ResourceIDInfo
Children []*ChildBlueprintIDInfo
Links []*LinkIDInfo
Total int
}
CollectedElements holds resources, children and links that have been collected for an action in the deployment process for a blueprint instance.
type CollectedResourceData ¶
type CollectedResourceData struct {
Spec *core.MappingNode
Metadata *state.ResourceMetadataState
TemplateName string
Description string
}
CollectedResourceData holds the spec state and metadata for a resource that is being deployed, this structure is primarily used to temporarily store the result of resolving substitutions and deploying the resource to be persisted shortly after.
type DependenciesOverrider ¶
type DependenciesOverrider func( depsToOverride *BlueprintContainerDependencies, ) *BlueprintContainerDependencies
DependenciesOverrider is a function that customises the dependencies used to instantiate a blueprint container on each call to load a blueprint.
type DeployChannels ¶
type DeployChannels struct {
// ResourceUpdateChan receives messages about the status of deployment for resources.
ResourceUpdateChan chan ResourceDeployUpdateMessage
// LinkUpdateChan receives messages about the status of deployment for links.
LinkUpdateChan chan LinkDeployUpdateMessage
// ChildUpdateChan receives messages about the status of deployment for child blueprints.
ChildUpdateChan chan ChildDeployUpdateMessage
// DeploymentUpdateChan receives messages about the status of the blueprint instance deployment.
DeploymentUpdateChan chan DeploymentUpdateMessage
// FinishChan is used to signal that the blueprint instance deployment has finished,
// the message will contain the final status of the deployment.
FinishChan chan DeploymentFinishedMessage
// ErrChan is used to signal that an unexpected error occurred during deployment of changes.
ErrChan chan error
}
DeployChannels contains all the channels required to stream deployment events.
func CreateDeployChannels ¶
func CreateDeployChannels() *DeployChannels
CreateDeployChannels creates a new DeployChannels struct that contains all the channels required to process deploy/destroy events.
type DeployContext ¶
type DeployContext struct {
StartTime time.Time
Rollback bool
Destroying bool
State DeploymentState
Channels *DeployChannels
// A snapshot of the instance state taken before deployment.
InstanceStateSnapshot *state.InstanceState
ParamOverrides core.BlueprintParams
ResourceProviders map[string]provider.Provider
CurrentGroupIndex int
DeploymentGroups [][]*DeploymentNode
InputChanges *changes.BlueprintChanges
// A mapping of resource names to the name of the resource
// templates they were derived from.
ResourceTemplates map[string]string
// Holds the container for the blueprint after preparation/pre-processing
// including template expansion and applying resource conditions.
PreparedContainer BlueprintContainer
// Provides a deployment-scoped registry for resources that will be packed
// with the parameter overrides supplied in a container "Deploy" or "Destroy"
// method call.
ResourceRegistry resourcehelpers.Registry
Logger core.Logger
}
DeployContext holds information shared between components that handle different parts of the deployment process for a blueprint instance.
func DeployContextWithChannels ¶
func DeployContextWithChannels( deployCtx *DeployContext, channels *DeployChannels, ) *DeployContext
func DeployContextWithGroup ¶
func DeployContextWithGroup( deployCtx *DeployContext, groupIndex int, ) *DeployContext
func DeployContextWithInstanceSnapshot ¶
func DeployContextWithInstanceSnapshot( deployCtx *DeployContext, instanceSnapshot *state.InstanceState, ) *DeployContext
func DeployContextWithLogger ¶
func DeployContextWithLogger( deployCtx *DeployContext, logger core.Logger, ) *DeployContext
type DeployEvent ¶
type DeployEvent struct {
// ResourceUpdateEvent is an event that is emitted when a resource is updated.
ResourceUpdateEvent *ResourceDeployUpdateMessage
// LinkUpdateEvent is an event that is emitted when a link is updated.
LinkUpdateEvent *LinkDeployUpdateMessage
// ChildUpdateEvent is an event that is emitted when a child blueprint is updated.
ChildUpdateEvent *ChildDeployUpdateMessage
// DeploymentUpdateEvent is an event that is emitted when the
// deployment status of the blueprint instance is updated.
DeploymentUpdateEvent *DeploymentUpdateMessage
// FinishEvent is an event that is emitted when the deployment
// of the blueprint instance has finished.
FinishEvent *DeploymentFinishedMessage
}
DeployEvent contains an event that is emitted during the deployment process. This is used like a sum type to represent the different types of events that can be emitted.
func (*DeployEvent) MarshalJSON ¶
func (e *DeployEvent) MarshalJSON() ([]byte, error)
func (*DeployEvent) UnmarshalJSON ¶
func (e *DeployEvent) UnmarshalJSON(data []byte) error
type DeployInput ¶
type DeployInput struct {
// InstanceID is the ID of the blueprint instance that the changes will be deployed for.
// If this is set, `InstanceName` must be empty.
InstanceID string
// InstanceName is the user-defined name of the blueprint instance that
// the changes will be deployed for.
// If this is set, `InstanceID` must be empty.
InstanceName string
// Changes contains the changes that will be made to the blueprint instance.
Changes *changes.BlueprintChanges
// Rollback is used to indicate that the changes being deployed represent a rollback.
// This is useful for ensuring the correct statuses are applied when changes within a child
// blueprint need to be rolled back due to a failure in the parent blueprint.
// The loaded blueprint is expected to be the version of the blueprint to roll back to
// for a given blueprint instance.
Rollback bool
}
DeployInput contains the primary input needed to deploy a blueprint instance.
type DeploymentFinishedMessage ¶
type DeploymentFinishedMessage struct {
// InstanceID is the ID of the blueprint instance
// the message is associated with.
InstanceID string `json:"instanceId"`
// Status holds the status of the instance deployment.
Status core.InstanceStatus `json:"status"`
// FailureReasons holds a list of reasons why the instance failed to deploy
// if the final status is a failure.
FailureReasons []string `json:"failureReasons,omitempty"`
// FinishTimestamp is the unix timestamp in seconds for
// when the deployment finished.
FinishTimestamp int64 `json:"finishTimestamp"`
// UpdateTimestamp is the unix timestamp in seconds for
// when the status update occurred.
UpdateTimestamp int64 `json:"updateTimestamp"`
// Durations holds duration information for the blueprint deployment.
// Duration information is attached on one of the following status updates:
// - InstanceStatusDeploying (preparation phase duration only)
// - InstanceStatusDeployed
// - InstanceStatusDeployFailed
// - InstanceStatusDeployRollbackFailed
// - InstanceStatusDeployRollbackComplete
// - InstanceStatusDestroyed
// - InstanceStatusDestroyFailed
// - InstanceStatusDestroyRollbackFailed
// - InstanceStatusDestroyRollbackComplete
// - InstanceStatusUpdated
// - InstanceStatusUpdateFailed
// - InstanceStatusUpdateRollbackFailed
// - InstanceStatusUpdateRollbackComplete
Durations *state.InstanceCompletionDuration `json:"durations,omitempty"`
}
DeploymentFinishedMessage provides a message containing the final status of the blueprint instance deployment.
type DeploymentNode ¶
type DeploymentNode struct {
ChainLinkNode *links.ChainLinkNode
ChildNode *refgraph.ReferenceChainNode
// DirectDependencies holds the direct dependencies of the given deployment
// node.
// This isn't populated upon creation of the deployment node,
// as ordering of the nodes does not compare every node,
// the dependencies list would be incomplete.
// This is primarily used for the deployment process where the container
// will populate the direct dependencies of each node as a part of the
// preparation phase.
DirectDependencies []*DeploymentNode
}
DeploymentNode is a node that represents a resource or a child blueprint to be deployed (or staged for deployment).
func OrderItemsForDeployment ¶
func OrderItemsForDeployment( ctx context.Context, chains []*links.ChainLinkNode, children []*refgraph.ReferenceChainNode, refChainCollector refgraph.RefChainCollector, params bpcore.BlueprintParams, ) ([]*DeploymentNode, error)
OrderItemsForDeployment deals with creating a flat ordered slice of chain link nodes and child blueprints for change staging and deployments. Ordering is determined by the priority resource type specified in each link implementation and usage of references between resources and child blueprints. A reference is treated as a hard link where the priority resource or child blueprint is the one being referenced.
It is a requirement for the input chains and child blueprints to not have any direct or transitive circular hard links. A hard link is when one resource type requires the other in a link relationship to be deployed first or where a reference is made to a resource or child blueprint.
For the following set of chains and child blueprints:
(lt) = the linked to resource is the priority resource type. (lf) = the linked from resource is the priority resource type. (rb:{referencedBy}) = referenced by other item.
*All the links in the example below are hard links.
Chain 1 ├── ResourceA1 │ ├── ResourceA2 (lf) │ │ ├── ResourceA4 (lt) │ │ └── ResourceA5 (lt) │ └── ResourceA3 (lf) │ └── ResourceA6 (lf)
Chain 2 ├── ResourceB1 │ ├── ResourceB2 (lt) │ │ ├── ResourceB4 (lt) (rb:ResourceA5) │ │ │ └── ResourceA6 (lt) │ │ └── ResourceB5 (lt) (rb:Child2) │ └── ResourceB3 (lf) │ └── ResourceB6 (lt)
Child1 (rb:ResourceA4)
Child2 (rb:ResourceA5)
We will want output like: [
Child1, ResourceA4, ResourceA1, ResourceA3, ResourceA6, ResourceB4, ResourceB5, Child2, ResourceA5, ResourceA2, ResourceB2, ResourceB1, ResourceB6, ResourceB3
]
What matters in the output is that resources are ordered by the priority definition of the links and based on references (treated the same as hard links), the order of items that have no direct or transitive relationship are irrelevant.
func (*DeploymentNode) Name ¶
func (d *DeploymentNode) Name() string
func (*DeploymentNode) Type ¶
func (d *DeploymentNode) Type() DeploymentNodeType
type DeploymentNodeType ¶
type DeploymentNodeType string
DeploymentNodeType is the type of a deployment node extracted from a source blueprint.
const ( // DeploymentNodeTypeResource is a deployment node that represents a resource // to be deployed. DeploymentNodeTypeResource DeploymentNodeType = "resource" // DeploymentNodeTypeChild is a deployment node that represents a child blueprint // to be deployed. DeploymentNodeTypeChild DeploymentNodeType = "child" )
type DeploymentState ¶
type DeploymentState interface {
// SetDestroyedElement marks an element in the current
// deployment as destroyed.
SetDestroyedElement(element state.Element)
// SetUpdatedEleemnt marks an element in the current
// deployment as updated.
SetUpdatedElement(element state.Element)
// SetCreatedElement marks an element in the current
// deployment as created.
SetCreatedElement(element state.Element)
// SetElementInProgress marks an element in the current
// deployment as in progress.
SetElementInProgress(element state.Element)
// IsElementInProgress checks if an element is currently in progress
// in the deployment process.
IsElementInProgress(element state.Element) bool
// SetElementConfigComplete marks an element in the current
// deployment as having its configuration completed.
SetElementConfigComplete(element state.Element)
// IsElementConfigComplete checks if an element has had its configuration
// completed in the deployment process.
IsElementConfigComplete(element state.Element) bool
// CheckUpdateElementDeploymentStarted checks if the deployment of an element has already started
// and updates the deployment state at the same time.
// This makes checking and writing the deployment started state atomic while taking into account
// other factors that should be considered when checking if the deployment should be started.
// This is primarily useful for avoiding starting the deployment of an element
// multiple times.
CheckUpdateElementDeploymentStarted(element state.Element, otherConditionToStart bool) bool
// SetLinkDurationInfo stores the duration information for multiple stages
// of the deployment of a link.
SetLinkDurationInfo(linkName string, durations *state.LinkCompletionDurations)
// GetLinkDurationInfo returns the duration information for multiple stages
// of the deployment of a link.
GetLinkDurationInfo(linkName string) *state.LinkCompletionDurations
// SetPrepareDuration sets the duration of the preparation phase for the deployment
// of a blueprint instance.
SetPrepareDuration(prepareDuration time.Duration)
// SetResourceDurationInfo sets the duration information for the "config completion"
// stage of the deployment of a resource.
SetResourceDurationInfo(resourceName string, durations *state.ResourceCompletionDurations)
// GetResourceDurationInfo returns the duration information for the "config completion"
// stage of the deployment of a resource.
GetResourceDurationInfo(resourceName string) *state.ResourceCompletionDurations
// GetPrepareDuration returns the duration of the preparation phase for the deployment
// of a blueprint instance.
GetPrepareDuration() *time.Duration
// SetResourceData sets the spec state and metadata for a resource that has been created
// or updated.
SetResourceData(resourceName string, specState *CollectedResourceData)
// GetResourceData returns the spec state and metadata for a resource that has been created
// or updated.
GetResourceData(resourceName string) *CollectedResourceData
// UpdateLinkDeploymentState updates the state of links that are pending completion
// and returns a list of links that are ready to be deployed or updated.
UpdateLinkDeploymentState(node *links.ChainLinkNode) []*LinkPendingCompletion
// SetLinkDeployResult sets the result of the deployment of a link
// to be used for persisting.
// This is primarily meant to store the result
// in ephemeral state straight after a link has been deployed to be
// persisted later.
SetLinkDeployResult(linkName string, result *LinkDeployResult)
// GetLinkDeployResult returns the result of the deployment of a link.
GetLinkDeployResult(linkName string) *LinkDeployResult
// SetElementDependencies sets the dependencies of a resource or child blueprint
// element in the deployment state.
SetElementDependencies(element state.Element, dependencies *state.DependencyInfo)
// GetElementDependencies returns the dependencies of a resource or child blueprint
// element in the deployment state.
GetElementDependencies(element state.Element) *state.DependencyInfo
}
DeploymentState provides functionality for tracking and setting the state of a deployment. In most cases, this is to be treated as ephemeral state that lasts for the duration of a deployment operation. This is not to be confused with the state of blueprint instances, which is persisted with implementations of the state.Container interface.
func NewDefaultDeploymentState ¶
func NewDefaultDeploymentState() DeploymentState
NewDefaultDeploymentState creates a new instance of the default implementation for tracking and setting the state of a deployment. The default implementation is a thread-safe, ephemeral store for deployment state.
type DeploymentStateFactory ¶
type DeploymentStateFactory func() DeploymentState
DeploymentStateFactory provides a factory function for creating a new instance of a deployment state that is used as an ephemeral store for tracking the state of a deployment operation.
type DeploymentUpdateMessage ¶
type DeploymentUpdateMessage struct {
// InstanceID is the ID of the blueprint instance
// the message is associated with.
InstanceID string `json:"instanceId"`
// Status holds the status of the instance deployment.
Status core.InstanceStatus `json:"status"`
// UpdateTimestamp is the unix timestamp in seconds for
// when the status update occurred.
UpdateTimestamp int64 `json:"updateTimestamp"`
}
DeploymentUpdateMessage provides a message containing a blueprint-wide status update for the deployment of a blueprint instance.
type DestroyInput ¶
type DestroyInput struct {
// InstanceID is the ID of the blueprint instance that will be destroyed.
// If this is set, `InstanceName` must be empty.
InstanceID string
// InstanceName is the user-defined name of the blueprint instance
// that will be destroyed.
// If this is set, `InstanceID` must be empty.
InstanceName string
// Changes contains a description of all the elements that need to be
// removed when destroying the blueprint instance.
Changes *changes.BlueprintChanges
// Rollback is used to indicate that the blueprint instance is being destroyed
// as part of a rollback operation.
// This is useful for ensuring the correct statuses are applied when changes within a child
// blueprint need to be rolled back due to a failure in the parent blueprint.
Rollback bool
}
DestroyInput contains the primary input needed to destroy a blueprint instance.
type ElementWithAllDeps ¶
type ElementWithAllDeps struct {
Element state.Element
// All collected dependencies for an element, both direct and transitive.
// This is particularly useful for grouping a pre-sorted list of elements
// to remove into sets of elements that can be processed in parallel.
AllDependencies []state.Element
// A list of direct dependencies for an element, particularly useful
// for building a reference chain for sorting.
DirectDependencies []state.Element
}
ElementsWithAllDeps stores a representation of an element in a blueprint with all of its dependencies, both direct and transitive. This is primarily used for collecting and ordering elements for removal.
func OrderElementsForRemoval ¶
func OrderElementsForRemoval( elements *CollectedElements, currentState *state.InstanceState, ) ([]*ElementWithAllDeps, error)
OrderElementsForRemoval orders resources, children and links for removal based on dependencies in the current state of a blueprint instance.
For the following dependency tree for a set of elements to be removed: (dependencies are the child nodes)
├── ResourceA1 │ ├── ResourceA2 │ │ ├── ChildA1 │ │ └── ResourceA5 │ └── ResourceA3 │ └── ResourceA6 ├── LinkA1(ResourceA1, ResourceA2) │ ├── ResourceA1 │ └── ResourceA2
A valid order for removal would be: 1. LinkA1 2. ResourceA1 3. ResourceA2 4. ResourceA3 5. ResourceA5 6. ResourceA6 7. ChildA1
func (*ElementWithAllDeps) Name ¶
func (e *ElementWithAllDeps) Name() string
type EventType ¶
type EventType string
EventType is a type that represents the different types of events that can be emitted during the deployment process.
const ( // EventTypeResourceUpdate is an event type that represents a resource update event. EventTypeResourceUpdate EventType = "resourceUpdate" // EventTypeLinkUpdate is an event type that represents a link update event. EventTypeLinkUpdate EventType = "linkUpdate" // EventTypeChildUpdate is an event type that represents a child blueprint update event. EventTypeChildUpdate EventType = "childUpdate" // EventTypeDeploymentUpdate is an event type that represents a // blueprint instance deployment update event. EventTypeDeploymentUpdate EventType = "deploymentUpdate" // EventTypeFinish is an event type that represents a // blueprint instance deployment finish event. EventTypeFinish EventType = "finish" )
type ExpandedResourceTemplateResult ¶
type ExpandedResourceTemplateResult struct {
// ResourceTemplateMap is a map of resource template names
// to the expanded resource names derived from the template.
// This allows for looking up a resource in a template for substitution references
// such as `resources.orderBucket[0]` without having to update references
// as a part of resource template expansion.
ResourceTemplateMap map[string][]string
ExpandedBlueprint *schema.Blueprint
}
func ExpandResourceTemplates ¶
func ExpandResourceTemplates( ctx context.Context, blueprint *schema.Blueprint, substitutionResolver subengine.SubstitutionResolver, linkChains []*links.ChainLinkNode, cache *core.Cache[[]*core.MappingNode], ) (*ExpandedResourceTemplateResult, error)
ExpandResourceTemplates expands resource templates in a parsed blueprint. This function carries out the following work:
- Resolves the `each` input for resource templates.
- Converts a resource template into individual resources in the blueprint.
- Adjusts link selectors and labels for each resource derived from a template.
- Caches the resolved items for the `each` property of a resource template so they can be used to resolve each resource derived from the template later.
The resources expanded from the template will have names in the format:
{templateName}_{index} (e.g. orderBucket_0)
The following link relationships are supported for resource templates:
A regular resource links to a resource template. The labels from the resource template are applied to each expanded resource.
A resource template links to a regular resource. The link selector from the resource template is applied to each expanded resource.
A resource template links to another resource template where the resolved items list is of the same length. In the following definition, "RT" stands for resource template. Link selectors in RT(a) that correspend to labels in RT(b) are updated to include an index to match the resource at the same index in RT(b). Labels in RT(b) that correspond to link selectors in RT(a) are updated to include an index to allow the resource from RT(a) to select the resource from RT(b).
Links between resource templates of different lengths are not supported, this will result in an error during an attempt to expand the resource templates. This error has to be determined at runtime and not at the validation stage because the length of the resolved items for a resource template is not known until the value of the `each` property is resolved.
type IncludeSubstitutionResolver ¶
type IncludeSubstitutionResolver interface {
// ResolveInResource resolves substitutions in an include.
ResolveInInclude(
ctx context.Context,
includeName string,
include *schema.Include,
resolveTargetInfo *subengine.ResolveIncludeTargetInfo,
) (*subengine.ResolveInIncludeResult, error)
}
IncludeSubstitutionResolver provides an interface for a service that is responsible for resolving substitutions in an include definition.
type LinkChangeStager ¶
type LinkChangeStager interface {
StageChanges(
ctx context.Context,
linkImpl provider.Link,
currentResourceInfo *provider.ResourceInfo,
readyToStage *LinkPendingCompletion,
changeStagingState ChangeStagingState,
linkChangesChan chan LinkChangesMessage,
params core.BlueprintParams,
logger core.Logger,
) error
}
LinkChangeStager provides an interface for a service that stages changes for a link between two resources.
func NewDefaultLinkChangeStager ¶
func NewDefaultLinkChangeStager( stateContainer state.Container, substitutionResolver subengine.SubstitutionResolver, resourceCache *core.Cache[*provider.ResolvedResource], ) LinkChangeStager
NewDefaultLinkChangeStager creates a new instance of the default implementation of the service that stages changes for a link between two resources.
type LinkChangesMessage ¶
type LinkChangesMessage struct {
ResourceAName string `json:"resourceAName"`
ResourceBName string `json:"resourceBName"`
Removed bool `json:"removed"`
New bool `json:"new"`
Changes provider.LinkChanges `json:"changes"`
}
LinkChangesMessage provides a message containing the changes that will be made to a link between resources in a blueprint instance.
type LinkDeployResult ¶
type LinkDeployResult struct {
IntermediaryResourceStates []*state.LinkIntermediaryResourceState
LinkData *core.MappingNode
}
LinkDeployResult contains the result of deploying a link between two resources in a blueprint instance. LinkData contains the merged data from the link update operations on the two resources and intermediary resources.
type LinkDeployUpdateMessage ¶
type LinkDeployUpdateMessage struct {
// InstanceID is the ID of the blueprint instance
// the message is associated with.
// As updates are sent for parent and child blueprints,
// this ID is used to differentiate between them.
InstanceID string `json:"instanceId"`
// LinkID is the globally unique ID of the link.
LinkID string `json:"linkId"`
// LinkName is the logic name of the link in the blueprint.
// This is a combination of the 2 resources that are linked.
// For example, if a link is between a VPC and a subnet,
// the link name would be "vpc::subnet".
LinkName string `json:"linkName"`
// Status holds the high-level status of the link.
Status core.LinkStatus `json:"status"`
// PreciseStatus holds the detailed status of the link.
PreciseStatus core.PreciseLinkStatus `json:"preciseStatus"`
// FailureReasons holds a list of reasons why the link failed to deploy
// if the status update is for a failure.
FailureReasons []string `json:"failureReasons,omitempty"`
// Attempt is the current attempt number for applying the changes
// for the current stage of the link deployment/removal.
CurrentStageAttempt int `json:"currentStageAttempt"`
// CanRetryCurrentStage indicates if the operation for the link can be retried
// after this attempt of the current stage.
CanRetryCurrentStage bool `json:"canRetryCurrentStage"`
// UpdateTimestamp is the unix timestamp in seconds for
// when the status update occurred.
UpdateTimestamp int64 `json:"updateTimestamp"`
// Durations holds duration information for a link deployment.
// Duration information is attached on one of the following precise status updates:
// - PreciseLinkStatusResourceAUpdated
// - PreciseLinkStatusResourceAUpdateFailed
// - PreciseLinkStatusResourceAUpdateRollbackFailed
// - PreciseLinkStatusResourceAUpdateRollbackComplete
// - PreciseLinkStatusResourceBUpdated
// - PreciseLinkStatusResourceBUpdateFailed
// - PreciseLinkStatusResourceBUpdateRollbackFailed
// - PreciseLinkStatusResourceBUpdateRollbackComplete
// - PreciseLinkStatusIntermediaryResourcesUpdated
// - PreciseLinkStatusIntermediaryResourceUpdateFailed
// - PreciseLinkStatusIntermediaryResourceUpdateRollbackFailed
// - PreciseLinkStatusIntermediaryResourceUpdateRollbackComplete
Durations *state.LinkCompletionDurations `json:"durations,omitempty"`
}
ResourceChangesMessage provides a message containing status updates for resources being deployed. Deployment messages report on status changes for resources, the state of a resource will need to be fetched from the state container to get further information about the state of the resource.
type LinkDeployer ¶
type LinkDeployer interface {
Deploy(
ctx context.Context,
linkElement state.Element,
instanceID string,
linkUpdateType provider.LinkUpdateType,
linkImplementation provider.Link,
deployCtx *DeployContext,
retryPolicy *provider.RetryPolicy,
) error
}
LinkDeployer provides an interface for a service that deploys a link between two resources as a part of the deployment process for a blueprint instance. This can be used for creating, updating and deleting a link between two resources. "Deploying" a link in the context of destruction means detaching information saved in the 2 resources related to the link and the removal of any intermediary resources created by a provider link implementation.
func NewDefaultLinkDeployer ¶
func NewDefaultLinkDeployer(clock core.Clock, stateContainer state.Container) LinkDeployer
NewDefaultLinkDeployer creates a new instance of the default implementation of the service that deploys a link between two resources as a part of the deployment process for a blueprint instance.
type LinkDestroyer ¶
type LinkDestroyer interface {
Destroy(
ctx context.Context,
element state.Element,
instanceID string,
deployCtx *DeployContext,
)
}
LinkDestroyer provides an interface for a service that destroys a link between two resources.
func NewDefaultLinkDestroyer ¶
func NewDefaultLinkDestroyer( linkDeployer LinkDeployer, linkRegistry provider.LinkRegistry, defaultRetryPolicy *provider.RetryPolicy, ) LinkDestroyer
NewDefaultLinkDestroyer creates a new instance of the default implementation of the service that destroys a link between two resources.
type LinkIDInfo ¶
LinkIDInfo provides the globally unique ID and logical name of a link.
func (*LinkIDInfo) ID ¶
func (r *LinkIDInfo) ID() string
func (*LinkIDInfo) Kind ¶
func (r *LinkIDInfo) Kind() state.ElementKind
func (*LinkIDInfo) LogicalName ¶
func (r *LinkIDInfo) LogicalName() string
type LinkPendingCompletion ¶
type LinkPendingCompletion struct {
// contains filtered or unexported fields
}
LinkPendingCompletion holds information about the completion status of a link between two resources for change staging and deployment.
type Loader ¶
type Loader interface {
// Load deals with loading a blueprint specification from the local file system
// along with provider and blueprint variables.
// Provider and blueprint variables can be provided to the blueprint container
// methods at a later stage, you can provide an empty set of parameters when
// loading a spec.
Load(
ctx context.Context,
blueprintSpecFile string,
params bpcore.BlueprintParams,
) (BlueprintContainer, error)
// Validate deals with validating a specification that lies on the local
// file system without loading a blueprint container.
// Provider and blueprint variables can be provided for enhanced
// validation that also checks variables.
//
// This also returns validation diagnostics for warning and info level
// diagnostics that point out potential issues that may occur when executing
// a blueprint. Diagnostics do not include errors, errors should be unpacked from
// the returned error.
Validate(
ctx context.Context,
blueprintSpecFile string,
params bpcore.BlueprintParams,
) (*ValidationResult, error)
// LoadString deals with loading a blueprint specification from a string
// along with provider and blueprint variables.
// Provider and blueprint variables can be provided to the blueprint container
// methods at a later stage, you can provide an empty set of parameters when
// loading a spec.
LoadString(
ctx context.Context,
blueprintSpec string,
inputFormat schema.SpecFormat,
params bpcore.BlueprintParams,
) (BlueprintContainer, error)
// ValidateString deals with validating a specification provided as a string
// without loading a blueprint container.
// Provider and blueprint variables can be provided for enhanced
// validation that also checks variables.
//
// This also returns validation diagnostics for error, warning and info level
// diagnostics that point out potential issues that may occur when executing
// a blueprint. Diagnostics do not include all errors, errors should be unpacked from
// the returned error in addition to the diagnostics.
ValidateString(
ctx context.Context,
blueprintSpec string,
inputFormat schema.SpecFormat,
params bpcore.BlueprintParams,
) (*ValidationResult, error)
// LoadFromSchema deals with loading a blueprint specification from a schema
// that has already been parsed along with provider and blueprint variables.
// This is mostly useful for loading a blueprint from a schema cache to speed up
// loading times, this is especially useful for blueprints that make use of a lot
// ${..} substitutions and references.
// Provider and blueprint variables can be provided to the blueprint container
// methods at a later stage, you can provide an empty set of parameters when
// loading a spec.
LoadFromSchema(
ctx context.Context,
blueprintSchema *schema.Blueprint,
params bpcore.BlueprintParams,
) (BlueprintContainer, error)
// ValidateFromSchema deals with validating a specification provided as a schema
// without loading a blueprint container.
// Provider and blueprint variables can be provided for enhanced
// validation that also checks variables.
//
// This also returns validation diagnostics for error, warning and info level
// diagnostics that point out potential issues that may occur when executing
// a blueprint. Diagnostics do not include all errors, errors should be unpacked from
// the returned error in addition to the diagnostics.
ValidateFromSchema(
ctx context.Context,
blueprintSchema *schema.Blueprint,
params bpcore.BlueprintParams,
) (*ValidationResult, error)
}
Loader provides the interface for a service that deals with loading blueprints for which instances can be deployed. The loader also provides methods for validating a spec (and optionally its variables) without associating it with an instance.
func NewDefaultLoader ¶
func NewDefaultLoader( providers map[string]provider.Provider, specTransformers map[string]transform.SpecTransformer, stateContainer state.Container, childResolver includes.ChildResolver, opts ...LoaderOption, ) Loader
NewDefaultLoader creates a new instance of the default implementation of a blueprint container loader. The map of providers must be a map of provider namespaces to the implementation. For example, for all resource types "aws/*" you would have a mapping namespace "aws" to the AWS provider. The namespace must be the prefix of resource, data source and custom variable types defined by the provider. If there is no provider for the prefix of a resource, data source or custom variable type in a blueprint, it will fail.
You can provide options for multiple flags that can be set to determine how the loader should behave, such as whether to validate runtime values or validate after transformation when loading blueprints.
type LoaderOption ¶
type LoaderOption func(loader *defaultLoader)
func WithLoaderChangeStagingStateFactory ¶
func WithLoaderChangeStagingStateFactory(changeStagingStateFactory ChangeStagingStateFactory) LoaderOption
WithLoaderChangeStagingStateFactory sets the change staging state factory to be used by the loader.
When this option is not provided, the default change staging state factory is used to create an ephemeral, thread-safe store for staging changes.
func WithLoaderChildBlueprintDestroyer ¶
func WithLoaderChildBlueprintDestroyer(childBlueprintDestroyer ChildBlueprintDestroyer) LoaderOption
WithLoaderChildBlueprintDestroyer sets the child blueprint destroy service used in blueprint containers created by the loader.
When this option is not provided, the default child blueprint destroyer is used.
func WithLoaderClock ¶
func WithLoaderClock(clock bpcore.Clock) LoaderOption
WithLoaderClock sets the clock to be used by the loader.
When this option is not provided, the default value is the system clock.
func WithLoaderDataSourceRegistry ¶
func WithLoaderDataSourceRegistry(dataSourceRegistry provider.DataSourceRegistry) LoaderOption
WithLoaderDataSourceRegistry sets the data source registry to be used by the loader.
When this option is not provided, the default data source registry that is derived from the given providers is used.
func WithLoaderDefaultRetryPolicy ¶
func WithLoaderDefaultRetryPolicy(retryPolicy *provider.RetryPolicy) LoaderOption
WithLoaderDefaultRetryPolicy sets the default retry policy to be used for deployments in blueprint containers created by the loader.
func WithLoaderDependenciesOverrider ¶
func WithLoaderDependenciesOverrider(overrider DependenciesOverrider) LoaderOption
WithLoaderDependenciesOverrider sets the dependencies overrider to be used by the loader to customise the dependencies used to instantiate a blueprint container on each call to load a blueprint.
When this option is not provided, the initial, default dependencies will be used.
func WithLoaderDeploymentStateFactory ¶
func WithLoaderDeploymentStateFactory(deploymentStateFactory DeploymentStateFactory) LoaderOption
WithLoaderDeploymentStateFactory sets the deployment state factory to be used by the loader.
When this option is not provided, the default deployment state factory is used to create an ephemeral, thread-safe store for deployment state.
func WithLoaderDerivedFromTemplates ¶
func WithLoaderDerivedFromTemplates(derivedFromTemplates []string) LoaderOption
WithLoaderDerivedFromTemplates sets the list of resource names that are derived from resource templates. This is useful when you want to allow references to "elem" and "i" in resources derived from templates where the `each` property is not set.
func WithLoaderDriftCheckEnabled ¶
func WithLoaderDriftCheckEnabled(driftCheckEnabled bool) LoaderOption
WithLoaderDriftCheckEnabled sets the flag to determine whether drift checking should be enabled when staging changes for a blueprint.
When this option is not provided, the default value is false.
func WithLoaderDriftChecker ¶
func WithLoaderDriftChecker(driftChecker drift.Checker) LoaderOption
WithLoaderDriftChecker sets the drift checker service used in blueprint containers created by the loader.
When this option is not provided, the default drift checker is used.
func WithLoaderFunctionRegistry ¶
func WithLoaderFunctionRegistry(funcRegistry provider.FunctionRegistry) LoaderOption
WithLoaderFunctionRegistry sets the function registry to be used by the loader.
When this option is not provided, the default function registry that is derived from the given providers is used.
func WithLoaderIDGenerator ¶
func WithLoaderIDGenerator(idGenerator bpcore.IDGenerator) LoaderOption
WithLoaderIDGenerator sets the ID generator to be used by blueprint containers created by the loader in the deployment process.
When this option is not provided, a UUID generator is used.
func WithLoaderLinkDeployer ¶
func WithLoaderLinkDeployer(linkDeployer LinkDeployer) LoaderOption
WithLoaderLinkDeployer sets the link deploy service used in blueprint containers created by the loader.
When this option is not provided, the default link deployer is used.
func WithLoaderLinkDestroyer ¶
func WithLoaderLinkDestroyer(linkDestroyer LinkDestroyer) LoaderOption
WithLoaderLinkDestroyer sets the link destroy service used in blueprint containers created by the loader.
When this option is not provided, the default link destroyer is used.
func WithLoaderLinkRegistry ¶
func WithLoaderLinkRegistry(linkRegistry provider.LinkRegistry) LoaderOption
WithLoaderLinkRegistry sets the link registry to be used by the loader.
When this option is not provided, the default link registry that is derived from the given providers is used.
func WithLoaderLogger ¶
func WithLoaderLogger(logger bpcore.Logger) LoaderOption
WithLoaderLogger sets the logger to be used by the loader.
When this option is not provided, a default, no-op logger is used.
func WithLoaderRefChainCollectorFactory ¶
func WithLoaderRefChainCollectorFactory(factory func() refgraph.RefChainCollector) LoaderOption
WithLoaderRefChainCollectorFactory sets the reference chain collector factory to be used by the loader.
When this option is not provided, the default reference chain collector factory provided by the validation package is used.
func WithLoaderResolveWorkingDir ¶
func WithLoaderResolveWorkingDir(resolveWorkingDir corefunctions.WorkingDirResolver) LoaderOption
WithLoaderResolveWorkingDir sets the function to resolve the working directory to be used by the loader.
When this option is not provided, the default value is os.Getwd.
func WithLoaderResourceDestroyer ¶
func WithLoaderResourceDestroyer(resourceDestroyer ResourceDestroyer) LoaderOption
WithLoaderResourceDestroyer sets the resource destroy service used in blueprint containers created by the loader.
When this option is not provided, the default resource destroyer is used.
func WithLoaderResourceRegistry ¶
func WithLoaderResourceRegistry(resourceRegistry resourcehelpers.Registry) LoaderOption
WithLoaderResourceRegistry sets the resource registry to be used by the loader.
When this option is not provided, the default resource registry that is derived from the given providers and transformers is used.
func WithLoaderResourceStabilityPollingConfig ¶
func WithLoaderResourceStabilityPollingConfig(config *ResourceStabilityPollingConfig) LoaderOption
WithLoaderResourceStabilityPollingConfig sets the resource stability polling configuration to be used for deployment orchestration when waiting for resources to become stable.
When this option is not provided, the default resource stability polling configuration is used.
func WithLoaderResourceTemplates ¶
func WithLoaderResourceTemplates(resourceTemplates map[string]string) LoaderOption
WithLoaderResourceTemplates sets the resource templates to be used by the loader. Resource templates are a mapping of resource names to the templates they were derived from. This is useful when loading a derived blueprint where templates are not used but were in the original. This is primarily useful for rollback operations where a simplified blueprint is derived from the previous state of a blueprint instance.
When this option is not provided, an empty map will be used.
func WithLoaderTransformSpec ¶
func WithLoaderTransformSpec(transformSpec bool) LoaderOption
WithLoaderTransformSpec sets the flag to determine whether transformers should be applied to the blueprint spec when loading blueprints. This is useful when you want to validate a blueprint spec without applying any transformations. (e.g. validation for code editors or CLI dry runs)
When this option is not provided, the default value is true.
func WithLoaderValidateAfterTransform ¶
func WithLoaderValidateAfterTransform(validateAfterTransform bool) LoaderOption
WithLoaderValidateAfterTransform sets the flag to determine whether resource validation should be performed after applying transformers to the blueprint spec. This is useful when you want to catch potential bugs in transformer implementations at the load/validate stage.
When this option is not provided, the default value is false.
func WithLoaderValidateRuntimeValues ¶
func WithLoaderValidateRuntimeValues(validateRuntimeValues bool) LoaderOption
WithLoaderValidateRuntimeValues sets the flag to determine whether runtime values should be validated when loading blueprints. This is useful when you want to validate a blueprint spec without associating it with an instance. (e.g. validation for code editors or CLI dry runs)
When this option is not provided, the default value is false.
type ResourceChangeStager ¶
type ResourceChangeStager interface {
StageChanges(
ctx context.Context,
instanceID string,
stagingState ChangeStagingState,
node *links.ChainLinkNode,
channels *ChangeStagingChannels,
resourceProviders map[string]provider.Provider,
params core.BlueprintParams,
logger core.Logger,
)
}
ResourceChangeStager provides an interface for a service that stages changes for a resource in a blueprint.
func NewDefaultResourceChangeStager ¶
func NewDefaultResourceChangeStager( substitutionResolver subengine.SubstitutionResolver, resourceCache *core.Cache[*provider.ResolvedResource], stateContainer state.Container, changeGenerator changes.ResourceChangeGenerator, linkChangeStager LinkChangeStager, ) ResourceChangeStager
NewDefaultResourceChangeStager creates a new instance of the default resource change stager.
type ResourceChangesMessage ¶
type ResourceChangesMessage struct {
ResourceName string `json:"resourceName"`
Removed bool `json:"removed"`
New bool `json:"new"`
Changes provider.Changes `json:"changes"`
ResolveOnDeploy []string `json:"resolveOnDeploy"`
// ConditionKnownOnDeploy is used to indicate that the condition for the resource
// can not be resolved until the blueprint is deployed.
// This means the changes described in this message may not be applied
// if the condition evaluates to false when the blueprint is deployed.
ConditionKnownOnDeploy bool `json:"conditionKnownOnDeploy"`
}
ResourceChangesMessage provides a message containing the changes that will be made to a resource in a blueprint instance.
type ResourceDeployUpdateMessage ¶
type ResourceDeployUpdateMessage struct {
// InstanceID is the ID of the blueprint instance
// the message is associated with.
// As updates are sent for parent and child blueprints,
// this ID is used to differentiate between them.
InstanceID string `json:"instanceId"`
// ResourceID is the globally unique ID of the resource.
ResourceID string `json:"resourceId"`
// ResourceName is the logical name of the resource
// as defined in the source blueprint.
ResourceName string `json:"resourceName"`
// Group is the group number the resource belongs to relative to the ordering
// for components in the current blueprint associated with the instance ID.
// A group is a collection of items that can be deployed or destroyed at the same time.
Group int `json:"group"`
// Status holds the high-level status of the resource.
Status core.ResourceStatus `json:"status"`
// PreciseStatus holds the detailed status of the resource.
PreciseStatus core.PreciseResourceStatus `json:"preciseStatus"`
// FailureReasons holds a list of reasons why the resource failed to deploy
// if the status update is for a failure.
FailureReasons []string `json:"failureReasons,omitempty"`
// Attempt is the current attempt number for deploying or destroying the resource.
Attempt int `json:"attempt"`
// CanRetry indicates if the operation for the resource can be retried
// after this attempt.
CanRetry bool `json:"canRetry"`
// UpdateTimestamp is the unix timestamp in seconds for
// when the status update occurred.
UpdateTimestamp int64 `json:"updateTimestamp"`
// Durations holds duration information for a resource deployment.
// Duration information is attached on one of the following precise status updates:
// - PreciseResourceStatusConfigComplete
// - PreciseResourceStatusCreated
// - PreciseResourceStatusCreateFailed
// - PreciseResourceStatusCreateRollbackFailed
// - PreciseResourceStatusCreateRollbackComplete
// - PreciseResourceStatusDestroyed
// - PreciseResourceStatusDestroyFailed
// - PreciseResourceStatusDestroyRollbackFailed
// - PreciseResourceStatusDestroyRollbackConfigComplete
// - PreciseResourceStatusDestroyRollbackComplete
// - PreciseResourceStatusUpdateConfigComplete
// - PreciseResourceStatusUpdated
// - PreciseResourceStatusUpdateFailed
// - PreciseResourceStatusUpdateRollbackFailed
// - PreciseResourceStatusUpdateRollbackConfigComplete
// - PreciseResourceStatusUpdateRollbackComplete
Durations *state.ResourceCompletionDurations `json:"durations,omitempty"`
}
ResourceDeployUpdateMessage provides a message containing status updates for resources being deployed. Deployment messages report on status changes for resources, the state of a resource will need to be fetched from the state container to get further information about the state of the resource.
type ResourceDeployer ¶
type ResourceDeployer interface {
Deploy(
ctx context.Context,
instanceID string,
chainLinkNode *links.ChainLinkNode,
changes *changes.BlueprintChanges,
deployCtx *DeployContext,
)
}
ResourceDeployer provides an interface for a service that deploys a resource as a part of the deployment process for a blueprint instance.
func NewDefaultResourceDeployer ¶
func NewDefaultResourceDeployer( clock core.Clock, idGenerator core.IDGenerator, defaultRetryPolicy *provider.RetryPolicy, stabilityPollingConfig *ResourceStabilityPollingConfig, substitutionResolver ResourceSubstitutionResolver, resourceCache *core.Cache[*provider.ResolvedResource], stateContainer state.Container, ) ResourceDeployer
NewDefaultResourceDeployer creates a new instance of the default implementation of the service that deploys a resource as a part of the deployment process for a blueprint instance.
type ResourceDestroyer ¶
type ResourceDestroyer interface {
Destroy(
ctx context.Context,
resourceElement state.Element,
instanceID string,
deployCtx *DeployContext,
)
}
ResourceDestroyer provides an interface for a service that destroys a resource as a part of the deployment process for a blueprint instance.
func NewDefaultResourceDestroyer ¶
func NewDefaultResourceDestroyer( clock core.Clock, defaultRetryPolicy *provider.RetryPolicy, ) ResourceDestroyer
NewDefaultResourceDestroyer creates a new instance of the default implementation of the service that destroys a resource as a part of the deployment process for a blueprint instance.
type ResourceIDInfo ¶
ResourceIDInfo provides the globally unique ID and logical name of a resource.
func (*ResourceIDInfo) ID ¶
func (r *ResourceIDInfo) ID() string
func (*ResourceIDInfo) Kind ¶
func (r *ResourceIDInfo) Kind() state.ElementKind
func (*ResourceIDInfo) LogicalName ¶
func (r *ResourceIDInfo) LogicalName() string
type ResourceStabilityPollingConfig ¶
type ResourceStabilityPollingConfig struct {
// PollingInterval is the interval at which the resource will be polled
// for stability.
PollingInterval time.Duration
// PollingTimeout is the maximum amount of time that the resource will be
// polled for stability.
PollingTimeout time.Duration
}
ResourceStabilityPollingConfig represents the configuration for polling resources for stability.
type ResourceSubstitutionResolver ¶
type ResourceSubstitutionResolver interface {
// ResolveInResource resolves substitutions in a resource.
ResolveInResource(
ctx context.Context,
resourceName string,
resource *schema.Resource,
resolveTargetInfo *subengine.ResolveResourceTargetInfo,
) (*subengine.ResolveInResourceResult, error)
}
ResourceSubstitutionResolver provides an interface for a service that is responsible for resolving substitutions in a resource definition.
type StageChangesInput ¶
type StageChangesInput struct {
// InstanceID is the ID of the blueprint instance that the changes will be applied to.
// If this is set, `InstanceName` must be empty.
InstanceID string
// InstanceName is the user-defined name of the blueprint instance
// that the changes will be applied to.
// If this is set, `InstanceID` must be empty.
InstanceName string
// Destroy is used to indicate that the changes being staged should be for a destroy operation.
// If this is set to true, the change set will be generated for removal all components
// in the current state of the blueprint instance.
Destroy bool
}
StageChangesInput contains the primary input needed to stage changes for a blueprint instance.
type ValidationResult ¶
type ValidationResult struct {
// Collected diagnostics from the validation process.
Diagnostics []*bpcore.Diagnostic
// The link information that was collected during validation.
LinkInfo links.SpecLinkInfo
// The parsed blueprint schema that was validated.
Schema *schema.Blueprint
}
ValidationResult provides information about the result of validating a blueprint.
Source Files
¶
- change_staging_state.go
- child_blueprint_consts.go
- child_blueprint_utils.go
- child_change_staging.go
- container.go
- container_change_staging.go
- container_change_staging_remove_utils.go
- container_change_staging_utils.go
- container_deploy.go
- container_destroy.go
- dependency_utils.go
- deploy_child_blueprint.go
- deploy_context.go
- deploy_link.go
- deploy_resource.go
- deployment_messages.go
- deployment_state.go
- deployment_utils.go
- destroy_child_blueprint.go
- destroy_link.go
- destroy_resource.go
- grouping_deployment.go
- grouping_removal.go
- link_change_staging.go
- load_errors.go
- loader.go
- noop_utils.go
- ordering_deployment.go
- ordering_removal.go
- prepare_blueprint.go
- resource_change_staging.go
- resource_spec_defaults.go
- run_errors.go
- template_expansion.go
- util_types.go
- utils.go