constructs

package module
v10.0.37-go-generics.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

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 software-defined state

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Construct_IsConstruct

func Construct_IsConstruct(x interface{}) _api_.Bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead

func Dependable_Implement

func Dependable_Implement(instance IDependable, trait Dependable)

Turn any object into an IDependable. Experimental.

func NewConstruct_Override

func NewConstruct_Override(c Construct, scope Construct, id _api_.String)

Creates a new construct node.

func NewDependable_Override

func NewDependable_Override(d Dependable)

Experimental.

func NewDependencyGroup_Override

func NewDependencyGroup_Override(d DependencyGroup, deps ...IDependable)

Experimental.

func NewNode_Override

func NewNode_Override(n Node, host Construct, scope IConstruct, id _api_.String)

func Node_PATH_SEP

func Node_PATH_SEP() _api_.String

Types

type Construct

type Construct interface {
	IConstruct
	Node() Node
	ToString() _api_.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 _api_.String) Construct

Creates a new construct node.

type ConstructOrder

type ConstructOrder string

In what order to return constructs.

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

func (ConstructOrder) FromOption__

func (c ConstructOrder) FromOption__() ConstructOrder

FromOption__ unwraps an ConstructOrder from an Option[ConstructOrder]. You should never need to call this method directly.

type Dependable

type Dependable interface {
	DependencyRoots() _api_.Slice[IConstruct]
}

Trait for IDependable.

Traits are interfaces that are privately implemented by objects. Instead of showing up in the public interface of a class, they need to be queried explicitly. This is used to implement certain framework features that are not intended to be used by Construct consumers, and so should be hidden from accidental use.

TODO: EXAMPLE

Experimental.

func Dependable_Get

func Dependable_Get(instance IDependable) Dependable

Return the matching Dependable for the given class instance. Deprecated: use `of`

func Dependable_Of

func Dependable_Of(instance IDependable) Dependable

Return the matching Dependable for the given class instance. Experimental.

type DependencyGroup

type DependencyGroup interface {
	IDependable
	Add(scopes ...IDependable)
}

A set of constructs to be used as a dependable.

This class can be used when a set of constructs which are disjoint in the construct tree needs to be combined to be used as a single dependable. Experimental.

func NewDependencyGroup

func NewDependencyGroup(deps ...IDependable) DependencyGroup

Experimental.

type IConstruct

type IConstruct interface {
	IDependable
	// The tree node.
	Node() Node
}

Represents a construct.

type IDependable

type IDependable interface {
}

Trait marker for classes that can be depended upon.

The presence of this interface indicates that an object has an `IDependableTrait` implementation.

This interface can be used to take an (ordering) dependency on a set of constructs. An ordering dependency implies that the resources represented by those constructs are deployed before the resources depending ON them are deployed.

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.
	// 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() _api_.Slice[_api_.String]
}

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

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"`
	// The metadata entry type.
	Type _api_.String `json:"type"`
	// Stack trace at the point of adding the metadata.
	//
	// Only available if `addMetadata()` is called with `stackTrace: true`.
	Trace _api_.Option[_api_.Slice[_api_.Option[_api_.String]]] `json:"trace"`
}

An entry in the construct metadata table.

func (MetadataEntry) FromOption__

func (m MetadataEntry) FromOption__() MetadataEntry

FromOption__ unwraps an MetadataEntry from an Option[MetadataEntry]. You should never need to call this method directly.

type MetadataOptions

type MetadataOptions struct {
	// Include stack trace with metadata entry.
	StackTrace _api_.Option[_api_.Bool] `json:"stackTrace"`
	// A JavaScript function to begin tracing from.
	//
	// This option is ignored unless `stackTrace` is `true`.
	TraceFromFunction interface{} `json:"traceFromFunction"`
}

Options for `construct.addMetadata()`.

func (MetadataOptions) FromOption__

func (m MetadataOptions) FromOption__() MetadataOptions

FromOption__ unwraps an MetadataOptions from an Option[MetadataOptions]. You should never need to call this method directly.

type Node

type Node interface {
	Addr() _api_.String
	Children() _api_.Slice[IConstruct]
	DefaultChild() _api_.Option[IConstruct]
	SetDefaultChild(val _api_.Option[IConstruct])
	Dependencies() _api_.Slice[IConstruct]
	Id() _api_.String
	Locked() _api_.Bool
	Metadata() _api_.Slice[MetadataEntry]
	Path() _api_.String
	Root() IConstruct
	Scope() _api_.Option[IConstruct]
	Scopes() _api_.Slice[IConstruct]
	AddDependency(deps ...IDependable)
	AddMetadata(type_ _api_.String, data interface{}, options _api_.Option[MetadataOptions])
	AddValidation(validation IValidation)
	FindAll(order _api_.Option[ConstructOrder]) _api_.Slice[IConstruct]
	FindChild(id _api_.String) IConstruct
	Lock()
	SetContext(key _api_.String, value interface{})
	TryFindChild(id _api_.String) _api_.Option[IConstruct]
	TryGetContext(key _api_.String) interface{}
	TryRemoveChild(childName _api_.String) _api_.Bool
	Validate() _api_.Slice[_api_.String]
}

Represents the construct node in the scope tree.

func NewNode

func NewNode(host Construct, scope IConstruct, id _api_.String) Node

func Node_Of

func Node_Of(construct IConstruct) Node

Returns the node associated with a construct. Deprecated: use `construct.node` instead

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