resourcehelpers

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrorReasonCodeProviderResourceTypeNotFound is provided when the
	// reason for a blueprint spec load error is due to
	// the resource provider missing an implementation for a
	// specific resource type.
	ErrorReasonCodeProviderResourceTypeNotFound errors.ErrorReasonCode = "resource_type_not_found"
	// ErrorReasonCodeMultipleRunErrors is provided when the reason
	// for a blueprint run error is due to multiple errors
	// occurring during the run.
	ErrorReasonCodeMultipleRunErrors errors.ErrorReasonCode = "multiple_run_errors"
	// ErrorReasonCodeAbstractResourceTypeNotFound is provided when the
	// reason for a blueprint run error is due to an abstract resource
	// type not being found in any of the loaded transformers.
	ErrorReasonCodeAbstractResourceTypeNotFound errors.ErrorReasonCode = "abstract_resource_type_not_found"
)

Variables

This section is empty.

Functions

func IsComputedField

func IsComputedField(changes *provider.Changes, fieldPath string) bool

IsComputedField returns whether the given field path is a computed field in the given set of resource changes.

func IsComputedFieldInList

func IsComputedFieldInList(expectedComputedFields []string, fieldPath string) bool

IsComputedFieldInList returns whether the given field path is a computed field in the given list of computed fields.

This allows for matching "[0]" and "[\"<key>\"]" placeholders in the expectedComputedFields list to match any array item or map key-value pair in the computed field path.

Types

type Registry

type Registry interface {
	// GetSpecDefinition returns the definition of a resource spec
	// in the registry.
	GetSpecDefinition(
		ctx context.Context,
		resourceType string,
		input *provider.ResourceGetSpecDefinitionInput,
	) (*provider.ResourceGetSpecDefinitionOutput, error)

	// GetTypeDescription returns the description of a resource type
	// in the registry.
	GetTypeDescription(
		ctx context.Context,
		resourceType string,
		input *provider.ResourceGetTypeDescriptionInput,
	) (*provider.ResourceGetTypeDescriptionOutput, error)

	// HasResourceType checks if a resource type is available in the registry.
	HasResourceType(ctx context.Context, resourceType string) (bool, error)

	// ListResourceTypes returns a list of all resource types available in the registry.
	ListResourceTypes(ctx context.Context) ([]string, error)

	// CustomValidate allows for custom validation of a resource of a given type.
	CustomValidate(
		ctx context.Context,
		resourceType string,
		input *provider.ResourceValidateInput,
	) (*provider.ResourceValidateOutput, error)

	// Deploy deals with the deployment of a resource of a given type.
	// The caller can specify whether or not to wait until the resource is considered
	// stable.
	Deploy(
		ctx context.Context,
		resourceType string,
		input *provider.ResourceDeployServiceInput,
	) (*provider.ResourceDeployOutput, error)

	// Destroy deals with the destruction of a resource of a given type.
	Destroy(
		ctx context.Context,
		resourceType string,
		input *provider.ResourceDestroyInput,
	) error

	// StabilisedDependencies lists the resource types that are required to be stable
	// when a resource that is a dependency of the given resource type is being deployed.
	GetStabilisedDependencies(
		ctx context.Context,
		resourceType string,
		input *provider.ResourceStabilisedDependenciesInput,
	) (*provider.ResourceStabilisedDependenciesOutput, error)

	// WithParams creates a new registry derived from the current registry
	// with the given parameters.
	WithParams(
		params core.BlueprintParams,
	) Registry
}

Registry provides a way to retrieve resource plugins across multiple providers and transformers for tasks such as resource spec validation.

func NewRegistry

func NewRegistry(
	providers map[string]provider.Provider,
	transformers map[string]transform.SpecTransformer,
	stabilisationPollingInterval time.Duration,
	params core.BlueprintParams,
) Registry

NewRegistry creates a new resource registry from a map of providers, matching against providers based on the resource type prefix.

Jump to

Keyboard shortcuts

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