resources

package
v0.0.0-...-f38f0d9 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AutoNamingTypeToken = "aws-native:index:AutoNaming"

Variables

This section is empty.

Functions

func ApplyDiff

ApplyDiff produces a new map as a merge of a calculated diff into an existing map of values.

func AutoNamingTypeSpec

func AutoNamingTypeSpec() pschema.ObjectTypeSpec

func CalculateUntypedPatch

func CalculateUntypedPatch(typedOldInputs ExtensionResourceInputs, typedInputs ExtensionResourceInputs) ([]jsonpatch.JsonPatchOperation, error)

func ExtensionResourceSpec

func ExtensionResourceSpec() pschema.ResourceSpec

func NewExtensionResource

func NewExtensionResource(client client.CloudControlClient) *extensionResource

Types

type AutoNaming

type AutoNaming struct {
	PropertyName string
	MinLength    int
	MaxLength    int
}

type CustomResource

type CustomResource interface {
	// Check validates and transforms the inputs of the resource.
	Check(ctx context.Context, urn resource.URN, randomSeed []byte, inputs, state resource.PropertyMap, defaultTags map[string]string) (resource.PropertyMap, []ValidationFailure, error)
	// Create creates a new resource in the cloud provider and returns its unique identifier and outputs.
	Create(ctx context.Context, urn resource.URN, inputs resource.PropertyMap) (identifier *string, outputs map[string]any, err error)
	// Read returns the outputs and the updated inputs of the resource.
	Read(ctx context.Context, urn resource.URN, id string, oldInputs, oldOutputs resource.PropertyMap) (outputs map[string]any, inputs resource.PropertyMap, exists bool, err error)
	// Update applies the diff of the inputs to the resource and returns the updated outputs.
	Update(ctx context.Context, urn resource.URN, id string, inputs, oldInputs resource.PropertyMap) (map[string]any, error)
	// Delete removes the resource from the cloud provider.
	Delete(ctx context.Context, urn resource.URN, id string, inputs resource.PropertyMap) error
}

type ExtensionResourceInputs

type ExtensionResourceInputs struct {
	Type         string
	Properties   map[string]any
	CreateOnly   []string
	WriteOnly    []string
	TagsProperty string
	TagsStyle    default_tags.TagsStyle
	AutoNaming   *AutoNaming
}

func (*ExtensionResourceInputs) AddWriteOnlyProps

func (r *ExtensionResourceInputs) AddWriteOnlyProps(resourceState map[string]interface{}) map[string]interface{}

AddWriteOnlyProps fills in the write-only properties from the old state as they won't be returned when reading.

type ValidationFailure

type ValidationFailure struct {
	Path   string
	Reason string
}

func ValidateResource

func ValidateResource(res *metadata.CloudAPIResource, types map[string]metadata.CloudAPIType, properties resource.PropertyMap) ([]ValidationFailure, error)

Jump to

Keyboard shortcuts

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