constructs

package module
v3.3.229 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: Apache-2.0 Imports: 3 Imported by: 619

README

Constructs

Software-defined persistent state

Release npm version PyPI version NuGet version Maven Central

What are constructs?

Constructs are classes which define a "piece of system state". Constructs can be composed together to form higher-level building blocks which represent more complex state.

Constructs are often used to represent the desired state of cloud applications. For example, in the AWS CDK, which is used to define the desired state for AWS infrastructure using CloudFormation, the lowest-level construct represents a resource definition in a CloudFormation template. These resources are composed to represent higher-level logical units of a cloud application, etc.

Contributing

This project has adopted the Amazon Open Source Code of Conduct.

We welcome community contributions and pull requests. See our contribution guide for more information on how to report issues, set up a development environment and submit code.

License

This project is distributed under the Apache License, Version 2.0.

Documentation

Overview

A programming model for composable configuration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructMetadata_DISABLE_STACK_TRACE_IN_METADATA added in v3.3.69

func ConstructMetadata_DISABLE_STACK_TRACE_IN_METADATA() *string

func ConstructMetadata_ERROR_METADATA_KEY added in v3.3.69

func ConstructMetadata_ERROR_METADATA_KEY() *string

func ConstructMetadata_INFO_METADATA_KEY added in v3.3.69

func ConstructMetadata_INFO_METADATA_KEY() *string

func ConstructMetadata_WARNING_METADATA_KEY added in v3.3.69

func ConstructMetadata_WARNING_METADATA_KEY() *string

func NewConstruct_Override added in v3.3.69

func NewConstruct_Override(c Construct, scope Construct, id *string, options *ConstructOptions)

Creates a new construct node.

func NewNode_Override added in v3.3.69

func NewNode_Override(n Node, host Construct, scope IConstruct, id *string)

func Node_PATH_SEP added in v3.3.69

func Node_PATH_SEP() *string

Types

type Construct

type Construct interface {
	IConstruct
	OnPrepare()
	OnSynthesize(session ISynthesisSession)
	OnValidate() *[]*string
	ToString() *string
}

Represents the building block of the construct graph.

All constructs besides the root construct must be created within the scope of another construct.

func NewConstruct

func NewConstruct(scope Construct, id *string, options *ConstructOptions) Construct

Creates a new construct node.

type ConstructMetadata

type ConstructMetadata interface {
}

Metadata keys used by constructs.

type ConstructOptions

type ConstructOptions struct {
	// A factory for attaching `Node`s to the construct.
	NodeFactory INodeFactory `json:"nodeFactory" yaml:"nodeFactory"`
}

Options for creating constructs.

type ConstructOrder

type ConstructOrder string

In what order to return constructs.

const (
	ConstructOrder_PREORDER  ConstructOrder = "PREORDER"
	ConstructOrder_POSTORDER ConstructOrder = "POSTORDER"
)

type Dependency

type Dependency struct {
	// Source the dependency.
	Source IConstruct `json:"source" yaml:"source"`
	// Target of the dependency.
	Target IConstruct `json:"target" yaml:"target"`
}

A single dependency.

type IAspect

type IAspect interface {
	// All aspects can visit an IConstruct.
	Visit(node IConstruct)
}

Represents an Aspect.

type IConstruct

type IConstruct interface {
}

Represents a construct.

type INodeFactory

type INodeFactory interface {
	// Returns a new `Node` associated with `host`.
	CreateNode(host Construct, scope IConstruct, id *string) Node
}

A factory for attaching `Node`s to the construct.

type ISynthesisSession

type ISynthesisSession interface {
	// The output directory for this synthesis session.
	Outdir() *string
}

Represents a single session of synthesis.

Passed into `construct.onSynthesize()` methods.

type IValidation

type IValidation interface {
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if there the construct is valid.
	Validate() *[]*string
}

Implement this interface in order for the construct to be able to validate itself.

type MetadataEntry

type MetadataEntry struct {
	// The data.
	Data interface{} `json:"data" yaml:"data"`
	// The metadata entry type.
	Type *string `json:"type" yaml:"type"`
	// Stack trace.
	//
	// Can be omitted by setting the context key
	// `ConstructMetadata.DISABLE_STACK_TRACE_IN_METADATA` to 1.
	Trace *[]*string `json:"trace" yaml:"trace"`
}

An entry in the construct metadata table.

type Node

type Node interface {
	Addr() *string
	Children() *[]IConstruct
	DefaultChild() IConstruct
	SetDefaultChild(val IConstruct)
	Dependencies() *[]*Dependency
	Id() *string
	Locked() *bool
	Metadata() *[]*MetadataEntry
	Path() *string
	Root() IConstruct
	Scope() IConstruct
	Scopes() *[]IConstruct
	UniqueId() *string
	AddDependency(dependencies ...IConstruct)
	AddError(message *string)
	AddInfo(message *string)
	AddMetadata(type_ *string, data interface{}, fromFunction interface{})
	AddValidation(validation IValidation)
	AddWarning(message *string)
	ApplyAspect(aspect IAspect)
	FindAll(order ConstructOrder) *[]IConstruct
	FindChild(id *string) IConstruct
	Prepare()
	SetContext(key *string, value interface{})
	Synthesize(options *SynthesisOptions)
	TryFindChild(id *string) IConstruct
	TryGetContext(key *string) interface{}
	TryRemoveChild(childName *string) *bool
	Validate() *[]*ValidationError
}

Represents the construct node in the scope tree.

func NewNode

func NewNode(host Construct, scope IConstruct, id *string) Node

func Node_Of

func Node_Of(construct IConstruct) Node

Returns the node associated with a construct.

type SynthesisOptions

type SynthesisOptions struct {
	// The output directory into which to synthesize the cloud assembly.
	Outdir *string `json:"outdir" yaml:"outdir"`
	// Additional context passed into the synthesis session object when `construct.synth` is called.
	SessionContext *map[string]interface{} `json:"sessionContext" yaml:"sessionContext"`
	// Whether synthesis should skip the validation phase.
	SkipValidation *bool `json:"skipValidation" yaml:"skipValidation"`
}

Options for synthesis.

type ValidationError

type ValidationError struct {
	// The error message.
	Message *string `json:"message" yaml:"message"`
	// The construct which emitted the error.
	Source Construct `json:"source" yaml:"source"`
}

An error returned during the validation phase.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

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