Documentation
¶
Index ¶
- Constants
- Variables
- func CreateDependencyRefTag(usedIn string) string
- func CreateLinkTag(linkDependencyOf string) string
- func CreateSubRefPropTag(usedIn string, usedInPropPath string) string
- func CreateSubRefTag(usedIn string) string
- func ErrMultipleValidationErrors(errs []error) error
- func ErrReferenceCycles(rootRefChains []*refgraph.ReferenceChainNode) error
- func ExtractDiagnosticsAndErrors(diagnostics []*core.Diagnostic, errorReasonCode bperrors.ErrorReasonCode) ([]*core.Diagnostic, error)
- func PreValidateResourceSpec(ctx context.Context, resourceName string, resourceSchema *schema.Resource, ...) error
- func ValidateBlueprint(ctx context.Context, blueprint *schema.Blueprint) ([]*bpcore.Diagnostic, error)
- func ValidateCoreVariable(ctx context.Context, varName string, varSchema *schema.Variable, ...) ([]*bpcore.Diagnostic, error)
- func ValidateCustomVariable(ctx context.Context, varName string, varSchema *schema.Variable, ...) ([]*bpcore.Diagnostic, error)
- func ValidateDataSource(ctx context.Context, name string, dataSource *schema.DataSource, ...) ([]*bpcore.Diagnostic, error)
- func ValidateDataSourceName(mappingName string, dataSourceMap *schema.DataSourceMap) error
- func ValidateExport(ctx context.Context, exportName string, exportSchema *schema.Export, ...) ([]*bpcore.Diagnostic, error)
- func ValidateInclude(ctx context.Context, includeName string, includeSchema *schema.Include, ...) ([]*core.Diagnostic, error)
- func ValidateIncludeName(mappingName string, includeMap *schema.IncludeMap) error
- func ValidateLinkAnnotations(ctx context.Context, linkChains []*links.ChainLinkNode, ...) ([]*core.Diagnostic, error)
- func ValidateMappingNode(ctx context.Context, usedIn string, attributePath string, ...) ([]*bpcore.Diagnostic, error)
- func ValidateReference(reference string, context string, hasAccessTo []Referenceable, ...) error
- func ValidateResource(ctx context.Context, name string, resource *schema.Resource, ...) ([]*bpcore.Diagnostic, error)
- func ValidateResourceEachDependencies(blueprint *schema.Blueprint, refChainCollector refgraph.RefChainCollector) error
- func ValidateResourceName(mappingName string, resourceMap *schema.ResourceMap) error
- func ValidateResourceSpec(ctx context.Context, params ResourceValidationParams, ...) ([]*core.Diagnostic, error)
- func ValidateSubstitution(ctx context.Context, sub *substitutions.Substitution, ...) (string, []*bpcore.Diagnostic, error)
- func ValidateTransforms(ctx context.Context, blueprint *schema.Blueprint, specWillBeTransformed bool) ([]*bpcore.Diagnostic, error)
- func ValidateValue(ctx context.Context, valName string, valSchema *schema.Value, ...) ([]*bpcore.Diagnostic, error)
- func ValidateValueName(mappingName string, valMap *schema.ValueMap) error
- func ValidateVariableName(mappingName string, varMap *schema.VariableMap) error
- type Referenceable
- type ResourceValidationParams
Constants ¶
const ( // ErrorReasonCodeMissingType is provided when the reason // for a blueprint spec load error is due to the version property // not being provided for a blueprint. ErrorReasonCodeMissingVersion errors.ErrorReasonCode = "missing_version" // ErrorReasonCodeInvalidVersion is provided when the reason // for a blueprint spec load error is due to an invalid version // of the spec being provided. ErrorReasonCodeInvalidVersion errors.ErrorReasonCode = "invalid_version" // ErrorReasonCodeInvalidResource is provided when the reason // for a blueprint spec load error is due to one or more resources // being invalid. ErrorReasonCodeInvalidResource errors.ErrorReasonCode = "invalid_resource" // ErrorReasonCodeResourceDefItemEmpty is provided when the reason // for a blueprint spec load error is due to an empty resource definition item. ErrorReasonCodeResourceDefItemEmpty errors.ErrorReasonCode = "resource_def_item_empty" // ErrorReasonCodeResourceDefInvalidType is provided when the reason // for a blueprint spec load error is due to an invalid type in a resource definition. ErrorReasonCodeResourceDefInvalidType errors.ErrorReasonCode = "resource_def_invalid_type" // ErrorReasonCodeResourceDefMissingRequiredField is provided when the reason // for a blueprint spec load error is due to a missing required field in a resource definition. ErrorReasonCodeResourceDefMissingRequiredField errors.ErrorReasonCode = "resource_def_missing_required_field" // ErrorReasonCodeResourceDefUnknownField is provided when the reason // for a blueprint spec load error is due to an unknown field in a resource definition. ErrorReasonCodeResourceDefUnknownField errors.ErrorReasonCode = "resource_def_unknown_field" // ErrorReasonCodeResourceDefUnionItemEmpty is provided when the reason // for a blueprint spec load error is due to an empty union item in a resource definition. ErrorReasonCodeResourceDefUnionItemEmpty errors.ErrorReasonCode = "resource_def_union_item_empty" // ErrorReasonCodeResourceDefUnionInvalidType is provided when the reason // for a blueprint spec load error is due to an invalid type in a union item. ErrorReasonCodeResourceDefUnionInvalidType errors.ErrorReasonCode = "resource_def_union_invalid_type" // ErrorReasonCodeResourceDefNotAllowedValue is provided when the reason // for a blueprint spec load error is due to a value not being in the allowed values list. ErrorReasonCodeResourceDefNotAllowedValue errors.ErrorReasonCode = "resource_def_not_allowed_value" // ErrorReasonCodeResourceDefPatternConstraintFailure is provided when the reason // for a blueprint spec load error is due to a pattern constraint failure. ErrorReasonCodeResourceDefPatternConstraintFailure errors.ErrorReasonCode = "resource_def_pattern_constraint_failure" // ErrorReasonCodeResourceDefMinConstraintFailure is provided when the reason // for a blueprint spec load error is due to a minimum value constraint failure. ErrorReasonCodeResourceDefMinConstraintFailure errors.ErrorReasonCode = "resource_def_min_constraint_failure" // ErrorReasonCodeResourceDefMaxConstraintFailure is provided when the reason // for a blueprint spec load error is due to a maximum value constraint failure. ErrorReasonCodeResourceDefMaxConstraintFailure errors.ErrorReasonCode = "resource_def_max_constraint_failure" // ErrorReasonCodeResourceDefComplexMinLengthConstraintFailure is provided when the reason // for a blueprint spec load error is due to a minimum length constraint failure for complex types. ErrorReasonCodeResourceDefComplexMinLengthConstraintFailure errors.ErrorReasonCode = "resource_def_complex_min_length_constraint_failure" // ErrorReasonCodeResourceDefComplexMaxLengthConstraintFailure is provided when the reason // for a blueprint spec load error is due to a maximum length constraint failure for complex types. ErrorReasonCodeResourceDefComplexMaxLengthConstraintFailure errors.ErrorReasonCode = "resource_def_complex_max_length_constraint_failure" // ErrorReasonCodeResourceDefStringMinLengthConstraintFailure is provided when the reason // for a blueprint spec load error is due to a minimum length constraint failure for strings. ErrorReasonCodeResourceDefStringMinLengthConstraintFailure errors.ErrorReasonCode = "resource_def_string_min_length_constraint_failure" // ErrorReasonCodeResourceDefStringMaxLengthConstraintFailure is provided when the reason // for a blueprint spec load error is due to a maximum length constraint failure for strings. ErrorReasonCodeResourceDefStringMaxLengthConstraintFailure errors.ErrorReasonCode = "resource_def_string_max_length_constraint_failure" // ErrorReasonCodeResourceTypeSpecDefMissing is provided when the reason // for a blueprint spec load error is due to a missing spec definition for a resource. ErrorReasonCodeResourceTypeSpecDefMissing errors.ErrorReasonCode = "resource_type_spec_def_missing" // ErrorReasonCodeResourceTypeSpecDefMissingSchema is provided when the reason // for a blueprint spec load error is due to a missing spec definition schema for a resource. ErrorReasonCodeResourceTypeSpecDefMissingSchema errors.ErrorReasonCode = "resource_type_spec_def_missing_schema" // ErrorReasonCodeDataSourceSpecDefMissing is provided when the reason // for a blueprint spec load error is due to a missing spec definition for a data source. ErrorReasonCodeDataSourceSpecDefMissing errors.ErrorReasonCode = "data_source_spec_def_missing" // ErrorReasonCodeMissingResourcesOrIncludes is provided when the reason // for a blueprint spec load error is due no resources or includes // being defined in the blueprint. // An empty map or omitted property will result in this error. ErrorReasonCodeMissingResourcesOrIncludes errors.ErrorReasonCode = "missing_resources" // ErrorReasonCodeInvalidVariable is provided when the reason // for a blueprint spec load error is due to one or more variables // being invalid. // This could be due to a mismatch between the type and the value, // a missing required variable (one without a default value), // an invalid default value, invalid allowed values or an incorrect variable type. ErrorReasonCodeInvalidVariable errors.ErrorReasonCode = "invalid_variable" // ErrorReasonCodeInvalidValue is provided when the reason // for a blueprint spec load error is due to an invalid value // being provided. ErrorReasonCodeInvalidValue errors.ErrorReasonCode = "invalid_value" // ErrorReasonCodeInvalidValueType is provided // when the reason for a blueprint spec load error is due // to an invalid value type. ErrorReasonCodeInvalidValueType errors.ErrorReasonCode = "invalid_value_type" // ErrorReasonCodeInvalidExport is provided when the reason // for a blueprint spec load error is due to one or more exports // being invalid. ErrorReasonCodeInvalidExport errors.ErrorReasonCode = "invalid_export" // ErrorReasonCodeInvalidReference is provided when the reason // for a blueprint spec load error is due to one or more references // being invalid. ErrorReasonCodeInvalidReference errors.ErrorReasonCode = "invalid_reference" // ErrorReasonCodeInvalidSubstitution is provided when the reason // for a blueprint spec load error is due to one or more substitutions // being invalid. ErrorReasonCodeInvalidSubstitution errors.ErrorReasonCode = "invalid_substitution" // ErrorReasonCodeInvalidInclude is provided when the reason // for a blueprint spec load error is due to one or more includes // being invalid. ErrorReasonCodeInvalidInclude errors.ErrorReasonCode = "invalid_include" // ErrorReasonCodeInvalidResource is provided when the reason // for a blueprint spec load error is due to one or more data sources // being invalid. ErrorReasonCodeInvalidDataSource errors.ErrorReasonCode = "invalid_data_source" // ErrorReasonCodeInvalidDataSourceFilterOperator is provided // when the reason for a blueprint spec load error is due // to an invalid data source filter operator being provided. ErrorReasonCodeInvalidDataSourceFilterOperator errors.ErrorReasonCode = "invalid_data_source_filter_operator" // ErrorReasonCodeUnsupportedDataSourceFilterOperator is provided // when the reason for a blueprint spec load error is due // to an unsupported data source filter operator being provided. ErrorReasonCodeUnsupportedDataSourceFilterOperator errors.ErrorReasonCode = "unsupported_data_source_filter_operator" // ErrorReasonCodeInvalidDataSourceFieldType is provided // when the reason for a blueprint spec load error is due // to an invalid data source field type. ErrorReasonCodeInvalidDataSourceFieldType errors.ErrorReasonCode = "invalid_data_source_field_type" // ErrorReasonCodeInvalidDataSourceFilterConflict is provided // when the reason for a blueprint spec load error is due // to a conflict between two filter fields in a data source, // where both fields can not be used to filter the same data source. ErrorReasonCodeDataSourceFilterConflict errors.ErrorReasonCode = "data_source_filter_conflict" // ErrorReasonCodeDataSourceFilterFieldNotSupported is provided // when the reason for a blueprint spec load error is due // to a data source having a field set as a filter that can't be used for filtering. ErrorReasonCodeDataSourceFilterFieldNotSupported errors.ErrorReasonCode = "data_source_filter_field_not_supported" // ErrorReasonCodeDataSourceMissingType is provided // when the reason for a blueprint spec load error is due // to a missing type for a data source. ErrorReasonCodeDataSourceMissingType errors.ErrorReasonCode = "data_source_missing_type" // ErrorReasonCodeInvalidMapKey is provided when the reason // for a blueprint spec load error is due to an invalid map key. ErrorReasonCodeInvalidMapKey errors.ErrorReasonCode = "invalid_map_key" // ErrorReasonCodeMultipleValidationErrors is provided when the reason // for a blueprint spec load error is due to multiple validation errors. ErrorReasonCodeMultipleValidationErrors errors.ErrorReasonCode = "multiple_validation_errors" // ErrorReasonCodeReferenceCycle is provided when the reason // for a blueprint spec load error is due to a reference cycle being detected. // This error code is used to collect and surface reference cycle errors // for pure substitution reference cycles and link <-> substitution reference cycles. ErrorReasonCodeReferenceCycle errors.ErrorReasonCode = "reference_cycle" // ErrorReasonCodeInvalidMappingNode is provided when the reason // for a blueprint spec load error is due to an invalid mapping node. ErrorReasonCodeInvalidMappingNode errors.ErrorReasonCode = "invalid_mapping_node" // ErrorReasonCodeInvalidResourceDependency is provided when the reason // for a blueprint spec load error is due to a resource dependency in the "dependsOn" // property not being a valid resource. ErrorReasonCodeMissingResourceDependency errors.ErrorReasonCode = "missing_resource_dependency" // ErrorReasonCodeComputedFieldInBlueprint is provided when the reason // for a blueprint spec load error is due to a computed field being used in a blueprint. // Computed fields are not allowed to be defined in blueprints, // they are computed by providers when a resource has been created. ErrorReasonCodeComputedFieldInBlueprint errors.ErrorReasonCode = "computed_field_in_blueprint" // ErrorReasonCodeEachResourceDependency is provided when the reason // for a blueprint spec load error is due to the "each" property of a resource // having a dependency on another resource. ErrorReasonCodeEachResourceDependency errors.ErrorReasonCode = "each_resource_dependency" // ErrorReasonCodeEachChildDependency is provided when the reason // for a blueprint spec load error is due to the "each" property of a resource // having a dependency on a child blueprint. ErrorReasonCodeEachChildDependency errors.ErrorReasonCode = "each_child_dependency" // ErrorReasonCodeSubFuncLinkArgResourceNotFound is provided when the reason // for a blueprint spec load error is due to a resource not being found // in an argument to the "link" substitution function. ErrorReasonCodeSubFuncLinkArgResourceNotFound errors.ErrorReasonCode = "sub_func_link_arg_resource_not_found" // ErrorReasonCodeVariableEmptyDefaultValue is provided when the reason // for a blueprint spec load error is due to an empty default value for a variable. ErrorReasonCodeVariableEmptyDefaultValue errors.ErrorReasonCode = "variable_empty_default_value" // ErrorReasonCodeVariableInvalidOrMissing is provided when the reason // for a blueprint spec load error is due to an invalid or missing variable value. ErrorReasonCodeVariableInvalidOrMissing errors.ErrorReasonCode = "variable_invalid_or_missing" // ErrorReasonCodeVariableEmptyValue is provided when the reason // for a blueprint spec load error is due to an empty variable value. ErrorReasonCodeVariableEmptyValue errors.ErrorReasonCode = "variable_empty_value" // ErrorReasonCodeVariableInvalidAllowedValue is provided when the reason // for a blueprint spec load error is due to an invalid allowed value for a variable. ErrorReasonCodeVariableInvalidAllowedValue errors.ErrorReasonCode = "variable_invalid_allowed_value" // ErrorReasonCodeVariableNullAllowedValue is provided when the reason // for a blueprint spec load error is due to a null allowed value for a variable. ErrorReasonCodeVariableNullAllowedValue errors.ErrorReasonCode = "variable_null_allowed_value" // ErrorReasonCodeVariableInvalidAllowedValues is provided when the reason // for a blueprint spec load error is due to invalid allowed values for a variable. ErrorReasonCodeVariableInvalidAllowedValues errors.ErrorReasonCode = "variable_invalid_allowed_values" // ErrorReasonCodeVariableInvalidAllowedValuesNotSupported is provided when the reason // for a blueprint spec load error is due to allowed values not being supported for a variable type. ErrorReasonCodeVariableInvalidAllowedValuesNotSupported errors.ErrorReasonCode = "variable_invalid_allowed_values_not_supported" // ErrorReasonCodeVariableValueNotAllowed is provided when the reason // for a blueprint spec load error is due to a variable value not being in the allowed values. ErrorReasonCodeVariableValueNotAllowed errors.ErrorReasonCode = "variable_value_not_allowed" // ErrorReasonCodeRequiredVariableMissing is provided when the reason // for a blueprint spec load error is due to a required variable being missing. ErrorReasonCodeRequiredVariableMissing errors.ErrorReasonCode = "required_variable_missing" // ErrorReasonCodeCustomVarValueNotInOptions is provided when the reason // for a blueprint spec load error is due to a custom variable value not being in the available options. ErrorReasonCodeCustomVarValueNotInOptions errors.ErrorReasonCode = "custom_variable_value_not_in_options" // ErrorReasonCodeMixedVariableTypes is provided when the reason // for a blueprint spec load error is due to mixed variable types // used in the options for a custom variable type. ErrorReasonCodeMixedVariableTypes errors.ErrorReasonCode = "mixed_variable_types" // ErrorReasonCodeCustomVarAllowedValuesNotInOptions is provided when the reason // for a blueprint spec load error is due to allowed values not being in the available options // for a custom variable type. ErrorReasonCodeCustomVarAllowedValuesNotInOptions errors.ErrorReasonCode = "custom_variable_allowed_values_not_in_options" // ErrorReasonCodeCustomVarDefaultValueNotInOptions is provided when the reason // for a blueprint spec load error is due to a default value not being in the available options // for a custom variable type. ErrorReasonCodeCustomVarDefaultValueNotInOptions errors.ErrorReasonCode = "custom_variable_default_value_not_in_options" // ErrorReasonCodeInvalidExportType is provided when the reason // for a blueprint spec load error is due to an invalid export type. ErrorReasonCodeInvalidExportType errors.ErrorReasonCode = "invalid_export_type" // ErrorReasonCodeMissingExportType is provided when the reason // for a blueprint spec load error is due to a missing export type. ErrorReasonCodeMissingExportType errors.ErrorReasonCode = "missing_export_type" // ErrorReasonCodeEmptyExportField is provided when the reason // for a blueprint spec load error is due to an empty export field. ErrorReasonCodeEmptyExportField errors.ErrorReasonCode = "empty_export_field" // ErrorReasonCodeInvalidReferencePattern is provided when the reason // for a blueprint spec load error is due to an invalid reference pattern. ErrorReasonCodeInvalidReferencePattern errors.ErrorReasonCode = "invalid_reference_pattern" // ErrorReasonCodeReferenceContextAccess is provided when the reason // for a blueprint spec load error is due to invalid reference context access. ErrorReasonCodeReferenceContextAccess errors.ErrorReasonCode = "reference_context_access" // ErrorReasonCodeIncludeEmptyPath is provided when the reason // for a blueprint spec load error is due to an empty include path. ErrorReasonCodeIncludeEmptyPath errors.ErrorReasonCode = "include_empty_path" // ErrorReasonCodeDataSourceMissingFilter is provided when the reason // for a blueprint spec load error is due to a missing data source filter. ErrorReasonCodeDataSourceMissingFilter errors.ErrorReasonCode = "data_source_missing_filter" // ErrorReasonCodeDataSourceEmptyFilter is provided when the reason // for a blueprint spec load error is due to an empty data source filter. ErrorReasonCodeDataSourceEmptyFilter errors.ErrorReasonCode = "data_source_empty_filter" // ErrorReasonCodeDataSourceMissingFilterField is provided when the reason // for a blueprint spec load error is due to a missing data source filter field. ErrorReasonCodeDataSourceMissingFilterField errors.ErrorReasonCode = "data_source_missing_filter_field" // ErrorReasonCodeDataSourceMissingFilterSearch is provided when the reason // for a blueprint spec load error is due to a missing data source filter search. ErrorReasonCodeDataSourceMissingFilterSearch errors.ErrorReasonCode = "data_source_missing_filter_search" // ErrorReasonCodeDataSourceMissingExports is provided when the reason // for a blueprint spec load error is due to missing data source exports. ErrorReasonCodeDataSourceMissingExports errors.ErrorReasonCode = "data_source_missing_exports" // ErrorReasonCodeDataSourceFilterFieldConflict is provided when the reason // for a blueprint spec load error is due to a data source filter field conflict. ErrorReasonCodeDataSourceFilterFieldConflict errors.ErrorReasonCode = "data_source_filter_field_conflict" // ErrorReasonCodeDataSourceFilterOperatorNotSupported is provided when the reason // for a blueprint spec load error is due to an unsupported data source filter operator. ErrorReasonCodeDataSourceFilterOperatorNotSupported errors.ErrorReasonCode = "data_source_filter_operator_not_supported" // ErrorReasonCodeDataSourceMissingFilterOperator is provided when the reason // for a blueprint spec load error is due to a missing data source filter operator. ErrorReasonCodeDataSourceMissingFilterOperator errors.ErrorReasonCode = "data_source_missing_filter_operator" // ErrorReasonCodeResourceSpecPreValidationFailed is provided when the reason // for a blueprint spec load error is due to resource spec pre-validation failure. ErrorReasonCodeResourceSpecPreValidationFailed errors.ErrorReasonCode = "resource_spec_pre_validation_failed" // ErrorReasonCodeMappingNodeKeyContainsSubstitution is provided when the reason // for a blueprint spec load error is due to a mapping node key containing substitution. ErrorReasonCodeMappingNodeKeyContainsSubstitution errors.ErrorReasonCode = "mapping_node_key_contains_substitution" // ErrorReasonCodeVariableInvalidDefaultValue is provided when the reason // for a blueprint spec load error is due to an invalid default value for a variable. ErrorReasonCodeVariableInvalidDefaultValue errors.ErrorReasonCode = "variable_invalid_default_value" )
const ( // Version2025_11_02 is the version of the blueprint specification // that is the sole version of the spec supported by the initial // version of the blueprint framework. Version2025_11_02 = "2025-11-02" )
Variables ¶
var ( // ExportCanReference is a list of objects that can be referenced // by an export. // In the current version of the specification, resources, data sources, // variables, values and child blueprints can be referenced by an export. ExportCanReference = []Referenceable{ ReferenceableResource, ReferenceableDataSource, ReferenceableVariable, ReferenceableValue, ReferenceableChild, } )
var ( // SupportedVersions is the list of versions of the blueprint // specification that are supported by this version of the blueprint // framework. SupportedVersions = []string{ Version2025_11_02, } )
Functions ¶
func CreateDependencyRefTag ¶
CreateDependencyRefTag creates a reference chain node tag for a dependency reference defined in a blueprint resource with the "dependsOn" property.
func CreateLinkTag ¶
CreateLinkTag creates a reference chain node tag for a dependency resource that is linked to or from another resource. This should contain the name of the resource that depends on the resource being tagged.
func CreateSubRefPropTag ¶
CreateSubRefPropTag creates a reference chain node tag for a substitution reference including the property path within the resource that holds the reference.
func CreateSubRefTag ¶
CreateSubRefTag creates a reference chain node tag for a substitution reference.
func ErrMultipleValidationErrors ¶
errMultipleValidationErrors is used to wrap multiple errors that occurred during validation. The idea is to collect and surface as many validation errors to the user as possible to provide them the full picture of issues in the blueprint instead of just the first error.
func ErrReferenceCycles ¶
func ErrReferenceCycles(rootRefChains []*refgraph.ReferenceChainNode) error
ErrReferenceCycles is used to wrap errors that occurred during reference cycle validation. This error is used to collect and surface reference cycle errors for pure substitution reference cycles and link <-> substitution reference cycles.
func ExtractDiagnosticsAndErrors ¶
func ExtractDiagnosticsAndErrors( diagnostics []*core.Diagnostic, errorReasonCode bperrors.ErrorReasonCode, ) ([]*core.Diagnostic, error)
ExtractDiagnosticsAndErrors extracts diagnostics and errors from the provided diagnostics slice. It returns a slice of diagnostics that are not errors, and a wrapper error for multiple validation errors assigned the given reason code if any are found.
func PreValidateResourceSpec ¶
func PreValidateResourceSpec( ctx context.Context, resourceName string, resourceSchema *schema.Resource, resourceMap *schema.ResourceMap, ) error
PreValidateResourceSpec pre-validates the resource specification against the blueprint specification. This primarily searches for invalid usage of substitutions in mapping keys. The main resource validation that invokes a user-provided resource implementation comes after this.
func ValidateBlueprint ¶
func ValidateBlueprint(ctx context.Context, blueprint *schema.Blueprint) ([]*bpcore.Diagnostic, error)
ValidateBlueprint ensures that the required top-level properties of a blueprint are populated. (When they are populated the schema takes care of the structure)
func ValidateCoreVariable ¶
func ValidateCoreVariable( ctx context.Context, varName string, varSchema *schema.Variable, varMap *schema.VariableMap, params bpcore.BlueprintParams, validateRuntimeParams bool, ) ([]*bpcore.Diagnostic, error)
ValidateCoreVariable deals with validating a blueprint variable against the supported core scalar variable types in the blueprint specification.
func ValidateCustomVariable ¶
func ValidateCustomVariable( ctx context.Context, varName string, varSchema *schema.Variable, varMap *schema.VariableMap, params bpcore.BlueprintParams, customVariableType provider.CustomVariableType, validateRuntimeParams bool, ) ([]*bpcore.Diagnostic, error)
ValidateCustomVariable validates a custom variable in a blueprint. This validation spans all the fields of a variable in the parsed schema as well as the runtime variable value provided by the user.
func ValidateDataSource ¶
func ValidateDataSource( ctx context.Context, name string, dataSource *schema.DataSource, dataSourceMap *schema.DataSourceMap, bpSchema *schema.Blueprint, params bpcore.BlueprintParams, funcRegistry provider.FunctionRegistry, refChainCollector refgraph.RefChainCollector, resourceRegistry resourcehelpers.Registry, dataSourceRegistry provider.DataSourceRegistry, logger bpcore.Logger, ) ([]*bpcore.Diagnostic, error)
ValidateDataSource ensures that a given data source matches the specification.
func ValidateDataSourceName ¶
func ValidateDataSourceName(mappingName string, dataSourceMap *schema.DataSourceMap) error
ValidateDataSourceName checks the validity of a data source name, primarily making sure that it does not contain any substitutions as per the spec.
func ValidateExport ¶
func ValidateExport( ctx context.Context, exportName string, exportSchema *schema.Export, exportMap *schema.ExportMap, bpSchema *schema.Blueprint, params bpcore.BlueprintParams, funcRegistry provider.FunctionRegistry, refChainCollector refgraph.RefChainCollector, resourceRegistry resourcehelpers.Registry, dataSourceRegistry provider.DataSourceRegistry, ) ([]*bpcore.Diagnostic, error)
ValidateExport validates an export in a blueprint. This ensures that the export type is valid and that the referenced field is in the valid format. This does not validate that the field of the export can not be resolved, as this export validation should be carried out before staging changes or deploying a blueprint.
func ValidateInclude ¶
func ValidateInclude( ctx context.Context, includeName string, includeSchema *schema.Include, includeMap *schema.IncludeMap, bpSchema *schema.Blueprint, params core.BlueprintParams, funcRegistry provider.FunctionRegistry, refChainCollector refgraph.RefChainCollector, resourceRegistry resourcehelpers.Registry, dataSourceRegistry provider.DataSourceRegistry, ) ([]*core.Diagnostic, error)
ValidateInclude deals with early stage validation of a child blueprint include. This validation is primarily responsible for ensuring the path of an include is not empty and that any substitutions used are valid. As we don't have enough extra information at the early stage at which this should run, it does not include validation of the path format or variables. Variable validation requires information about the variables that are available in the child blueprint, which is not available at this stage.
func ValidateIncludeName ¶
func ValidateIncludeName(mappingName string, includeMap *schema.IncludeMap) error
ValidateIncludeName checks the validity of a include name, primarily making sure that it does not contain any substitutions as per the spec.
func ValidateLinkAnnotations ¶
func ValidateLinkAnnotations( ctx context.Context, linkChains []*links.ChainLinkNode, params core.BlueprintParams, ) ([]*core.Diagnostic, error)
ValidateLinkAnnotations checks the validity of link annotations for one or more link chains represented as a graph-like data structure where resources are nodes and links are edges.
Each annotation is checked against the link annotation definitions for the provider plugin link implementation that connects two resources. This is intended to be used at the end of the validation process once a graph of resources and links has been built after all other elements in a blueprint have been validated. This must only be called after the provided link chains have been checked for cycles.
This validation supports dynamic annotation keys that can contain a single "<resourceName>" placeholder string. The value that "<resourceName>" represents must be the name of a resource that is linked to the resource type where the annotation is defined. Only a single "<resourceName>" placeholder is allowed for a dynamic annotation key. Dynamic keys are used to target specific resources when there are multiple resources of the same type linked to the resource where the annotation is defined. Default values are ignored for link annotation field definitions that have dynamic field names, the default value should be defined in an equivalent annotation that is not targeted at a specific resource name (e.g. "aws.lambda.dynamodb.accessType").
When an annotation definition with a dynamic name is required, it means that at least one annotation value that matches the pattern must be present.
Unknown annotation keys are ignored, allowing them to be used for other purposes.
This returns an error for any unexpected errors and will return a list of diagnostics for any validation errors and warnings.
func ValidateMappingNode ¶
func ValidateMappingNode( ctx context.Context, usedIn string, attributePath string, usedInResourceDerivedFromTemplate bool, mappingNode *bpcore.MappingNode, bpSchema *schema.Blueprint, params bpcore.BlueprintParams, funcRegistry provider.FunctionRegistry, refChainCollector refgraph.RefChainCollector, resourceRegistry resourcehelpers.Registry, dataSourceRegistry provider.DataSourceRegistry, ) ([]*bpcore.Diagnostic, error)
ValidateMappingNode ensures that all the substitutions used in a mapping node are valid. This is to be used in free form mapping nodes such as `metadata.custom` in data sources and resources.
func ValidateReference ¶
func ValidateReference( reference string, context string, hasAccessTo []Referenceable, location *source.Meta, ) error
ValidateReference validates a reference in a blueprint, a reference can be to a variable, resource, child blueprint or data source. This validation does not validate that the reference can be resolved, as this validation will normally be carried out at an early stage before information is available about what resources, variables, data sources or child blueprints are available.
func ValidateResource ¶
func ValidateResource( ctx context.Context, name string, resource *schema.Resource, resourceMap *schema.ResourceMap, bpSchema *schema.Blueprint, params bpcore.BlueprintParams, funcRegistry provider.FunctionRegistry, refChainCollector refgraph.RefChainCollector, resourceRegistry resourcehelpers.Registry, resourceDerivedFromTemplate bool, logger bpcore.Logger, dataSourceRegistry provider.DataSourceRegistry, ) ([]*bpcore.Diagnostic, error)
ValidateResource ensures that a given resource is valid as per the blueprint specification and the resource type specification definition exposed by the resource type provider.
func ValidateResourceEachDependencies ¶
func ValidateResourceEachDependencies( blueprint *schema.Blueprint, refChainCollector refgraph.RefChainCollector, ) error
ValidateResourceEachDependencies validates the dependencies of the `each` property of a resource. This should be called after all validation of a blueprint has been carried out and the full set of references have been collected.
func ValidateResourceName ¶
func ValidateResourceName(mappingName string, resourceMap *schema.ResourceMap) error
ValidateResourceName checks the validity of a resource name, primarily making sure that it does not contain any substitutions as per the spec.
func ValidateResourceSpec ¶
func ValidateResourceSpec( ctx context.Context, params ResourceValidationParams, resource *schema.Resource, resourceLocation *source.Meta, ) ([]*core.Diagnostic, error)
ValidateResourceSpec validates the `spec` field of a resource. In a blueprint, this is a free form object that can hold complex structures that define a resource's configuration. Each resource has its own schema that is defined by the provider, this function validates against that schema and runs custom validation defined by the provider. This will only traverse up to `MappingNodeMaxTraverseDepth` levels deep, if the depth is exceeded, validation will not be performed on further elements.
func ValidateSubstitution ¶
func ValidateSubstitution( ctx context.Context, sub *substitutions.Substitution, nextLocation *source.Meta, bpSchema *schema.Blueprint, usedInResourceDerivedFromTemplate bool, usedIn string, usedInPropertyPath string, params bpcore.BlueprintParams, funcRegistry provider.FunctionRegistry, refChainCollector refgraph.RefChainCollector, resourceRegistry resourcehelpers.Registry, dataSourceRegistry provider.DataSourceRegistry, ) (string, []*bpcore.Diagnostic, error)
ValidateSubstitution validates a substitution usage in a blueprint.
usedIn is the path to the element in the blueprint where the substitution is used. This should be in the format of "{elementType}.{elementName}" For example, "values.myValue" or "resources.myResource"
funcRegistry provides a registry of functions that can be used in the substitution. resourceRegistry provides a registry of resource types that are used to check accessed attributes against the resource spec.
This returns a string containing the type of the resolved value for the substitution where it can be determined, an empty string otherwise. The caller is responsible for ensuring that the resolved value type is compatible with the context where the substitution is used. It also returns a list of diagnostics that were generated during the validation process and an error if the validation process failed.
func ValidateTransforms ¶
func ValidateTransforms( ctx context.Context, blueprint *schema.Blueprint, specWillBeTransformed bool, ) ([]*bpcore.Diagnostic, error)
ValidateTransforms checks for non-standard transforms and reports warnings when the spec is not going to be transformed (e.g. dry run validation).
func ValidateValue ¶
func ValidateValue( ctx context.Context, valName string, valSchema *schema.Value, bpSchema *schema.Blueprint, params bpcore.BlueprintParams, funcRegistry provider.FunctionRegistry, refChainCollector refgraph.RefChainCollector, resourceRegistry resourcehelpers.Registry, dataSourceRegistry provider.DataSourceRegistry, ) ([]*bpcore.Diagnostic, error)
ValidateValue deals with validating a blueprint value against the supported value types in the blueprint specification.
func ValidateValueName ¶
ValidateValueName checks the validity of a value name, primarily making sure that it does not contain any substitutions as per the spec.
func ValidateVariableName ¶
func ValidateVariableName(mappingName string, varMap *schema.VariableMap) error
ValidateVariableName checks the validity of a variable name, primarily making sure that it does not contain any substitutions as per the spec.
Types ¶
type Referenceable ¶
type Referenceable string
Referencable is a type that can be referenced in a blueprint.
const ( // ReferenceableResource signifies that a resource // can be referenced for a given context in a blueprint. ReferenceableResource Referenceable = "resource" // ReferenceableVariable signifies that a variable // can be referenced for a given context in a blueprint. ReferenceableVariable Referenceable = "variable" // ReferenceableValue signifies that a value // can be referenced for a given context in a blueprint. ReferenceableValue Referenceable = "value" // ReferenceableDataSource signifies that a data source // can be referenced for a given context in a blueprint. ReferenceableDataSource Referenceable = "datasource" // ReferenceableChild signifies that a child blueprint // can be referenced for a given context in a blueprint. ReferenceableChild Referenceable = "child" )
type ResourceValidationParams ¶ added in v0.34.0
type ResourceValidationParams struct {
ResourceName string
ResourceType string
ResourceDerivedFromTemplate bool
BpSchema *schema.Blueprint
Params core.BlueprintParams
FuncRegistry provider.FunctionRegistry
RefChainCollector refgraph.RefChainCollector
ResourceRegistry resourcehelpers.Registry
DataSourceRegistry provider.DataSourceRegistry
}
ResourceValidationParams groups the non-context parameters used across validation functions
Source Files
¶
- blueprint_validation.go
- core_variable_validation.go
- custom_variable_validation.go
- data_source_validation.go
- diagnostic_errors.go
- errors.go
- errors_resource_definitions.go
- export_validation.go
- include_validation.go
- link_annotation_validation.go
- mapping_pre_validation.go
- mapping_validation.go
- references.go
- resource_definitions_validation.go
- resource_spec_validation.go
- resource_validation.go
- substitution_validation.go
- transform_validation.go
- utils.go
- value_validation.go