Documentation
¶
Index ¶
- func AnyEmptyString(values ...string) bool
- func CollectMetadataChanges(collectIn *MetadataChanges, ...)
- func GetArraySchema(schemas []*provider.ResourceDefinitionsSchema) *provider.ResourceDefinitionsSchema
- func GetResourceTypeFromResolved(resourceWithResolvedSubs *provider.ResolvedResource) string
- type BlueprintChanges
- type IntermediaryBlueprintChanges
- type MappingNodeTypeMatchInfo
- type MetadataChanges
- type NewBlueprintDefinition
- type ResourceChangeGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyEmptyString ¶
AnyEmptyString returns true if any of the given strings are empty or contain only whitespace.
func CollectMetadataChanges ¶
func CollectMetadataChanges( collectIn *MetadataChanges, resolveResult *subengine.ResolveInMappingNodeResult, currentMetadata map[string]*core.MappingNode, )
func GetArraySchema ¶
func GetArraySchema( schemas []*provider.ResourceDefinitionsSchema, ) *provider.ResourceDefinitionsSchema
GetArraySchema returns the first array schema in a list of schemas.
func GetResourceTypeFromResolved ¶
func GetResourceTypeFromResolved(resourceWithResolvedSubs *provider.ResolvedResource) string
GetResourceTypeFromResolved extracts a resource type from a resolved resource if possible. An empty string is returned if the resolved resource is nil or the type is nil.
Types ¶
type BlueprintChanges ¶
type BlueprintChanges struct {
// NewResources contains the resources that will be created
// when deploying the changes.
NewResources map[string]provider.Changes `json:"newResources"`
// ResourceChanges contains the changes that will be made to
// existing resources when deploying the changes.
ResourceChanges map[string]provider.Changes `json:"resourceChanges"`
// RemovedResources contains the name of the resources that will be removed
// when deploying the changes.
RemovedResources []string `json:"removedResources"`
// RemovedLinks contains the name of the links that will be removed
// when deploying the changes.
// These will be in the format "resourceAName::resourceBName".
RemovedLinks []string `json:"removedLinks"`
// NewChildren contains the child blueprints that will be created
// when deploying the changes.
NewChildren map[string]NewBlueprintDefinition `json:"newChildren"`
// ChildChanges contains the changes that will be made to the child blueprints
// when deploying the changes.
ChildChanges map[string]BlueprintChanges `json:"childChanges"`
// RecreateChildren contains the name of the child blueprints that will be recreated
// when deploying the changes.
// The reason for this will primarily be due to a dependency of a child blueprint
// being removed from the latest version of the host blueprint.
RecreateChildren []string `json:"recreateChildren"`
// RemovedChildren contains the name of the child blueprints that will be removed
// when deploying the changes.
RemovedChildren []string `json:"removedChildren"`
// NewExports contains new fields that will be exported from the blueprint.
NewExports map[string]provider.FieldChange `json:"newExports"`
// ExportChanges contains changes to exported fields.
ExportChanges map[string]provider.FieldChange `json:"exportChanges"`
// UnchangedExports contains the names of fields that will not be changed.
UnchangedExports []string `json:"unchangedExports"`
// RemovedExports contains the names of fields that will no longer be exported.
RemovedExports []string `json:"removedExports"`
// MetadataChanges contains changes to blueprint-wide metadata.
MetadataChanges MetadataChanges `json:"metadataChanges"`
// ResolveOnDeploy contains paths to properties in blueprint elements
// that contain substitutions that can not be resolved until the blueprint
// is deployed.
// This includes properties in resources, data sources, blueprint-wide metadata
// and exported fields.
ResolveOnDeploy []string `json:"resolveOnDeploy"`
}
BlueprintChanges provides a set of changes that will be made to a blueprint instance when deploying a new version of the source blueprint. This contains a mapping of resource name to the changes that will come into effect upon deploying the currently loaded version of a blueprint for a given instance ID. This also contains a mapping of child blueprint names to the changes that will come into effect upon deploying the child blueprint. Changes takes the type parameter interface{} as we can't know the exact range of resource types for a blueprint at compile time. We must check the resource types associated with a set of changes at runtime.
type IntermediaryBlueprintChanges ¶
type IntermediaryBlueprintChanges struct {
NewResources map[string]*provider.Changes
ResourceChanges map[string]*provider.Changes
RemovedResources []string
RemovedLinks []string
NewChildren map[string]*NewBlueprintDefinition
ChildChanges map[string]*BlueprintChanges
RemovedChildren []string
NewExports map[string]*provider.FieldChange
ExportChanges map[string]*provider.FieldChange
RemovedExports []string
MetadataChanges *MetadataChanges
UnchangedExports []string
ResolveOnDeploy []string
}
IntermediaryBlueprintChanges holds changes to a blueprint that are not yet finalised but are stored in temporary state for the duration of the change staging process. This differs from blueprint changes in that it holds pointers to change items that makes it more efficient to update the changes as the staging process progresses.
type MappingNodeTypeMatchInfo ¶
type MappingNodeTypeMatchInfo struct {
TypeMatches bool
Schema *provider.ResourceDefinitionsSchema
}
MappingNodeTypeMatchInfo contains information about whether the types of two mapping nodes match and the schema to be used for value comparisons.
func CheckMappingNodeTypesForFields ¶
func CheckMappingNodeTypesForFields( fieldsA, fieldsB map[string]*bpcore.MappingNode, unionSchema *provider.ResourceDefinitionsSchema, ) *MappingNodeTypeMatchInfo
CheckMappingNodeTypesForFields compares the fields in two mapping nodes to determine whether the types of the fields match the types in the union schema.
type MetadataChanges ¶
type MetadataChanges struct {
// NewFields contains new fields that will be added to the blueprint-wide metadata.
NewFields []provider.FieldChange `json:"newFields"`
// ModifiedFields contains changes to existing fields in the blueprint-wide metadata.
ModifiedFields []provider.FieldChange `json:"modifiedFields"`
// UnchangedFields contains the names of fields that will not be changed.
UnchangedFields []string `json:"unchangedFields"`
// RemovedFields contains the names of fields that will no longer be present.
RemovedFields []string `json:"removedFields"`
}
MetadataChanges holds information about changes to blueprint-wide metadata.
type NewBlueprintDefinition ¶
type NewBlueprintDefinition struct {
NewResources map[string]provider.Changes `json:"newResources"`
NewChildren map[string]NewBlueprintDefinition `json:"newChildren"`
NewExports map[string]provider.FieldChange `json:"newExports"`
}
NewBlueprintDefinition provides a definition for a new child blueprint that will be created when deploying a blueprint instance.
type ResourceChangeGenerator ¶
type ResourceChangeGenerator interface {
GenerateChanges(
ctx context.Context,
resourceInfo *provider.ResourceInfo,
resourceImplementation provider.Resource,
resolveOnDeploy []string,
params bpcore.BlueprintParams,
) (*provider.Changes, error)
}
ResourceChangeGenerator is an interface for a service that handles generating changes for a resource based on the current state of the resource, the resolved replacement resource spec and the spec definition provided by the resource plugin implementation.
func NewDefaultResourceChangeGenerator ¶
func NewDefaultResourceChangeGenerator() ResourceChangeGenerator
NewDefaultResourceChangeGenerator returns a new instance of the default implementation of a resource change generator.