cfz

package
v0.0.0-...-82e6de8 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ResourceDeletionPolicies provides quick access to the supported CloudFormation resource deletion policies.
	ResourceDeletionPolicies = struct {
		Delete               ResourceDeletionPolicy
		Snapshot             ResourceDeletionPolicy
		RetainExceptOnCreate ResourceDeletionPolicy
		Retain               ResourceDeletionPolicy
	}{
		Delete:               resourceDeletionPolicy("Delete"),
		Snapshot:             resourceDeletionPolicy("Snapshot"),
		RetainExceptOnCreate: resourceDeletionPolicy("RetainExceptOnCreate"),
		Retain:               resourceDeletionPolicy("Retain"),
	}
)
View Source
var (
	// ResourceUpdateReplacePolicies provides quick access to the supported update replace policies.
	ResourceUpdateReplacePolicies = struct {
		Delete   ResourceUpdateReplacePolicy
		Snapshot ResourceUpdateReplacePolicy
		Retain   ResourceUpdateReplacePolicy
	}{
		Delete:   resourceUpdateReplacePolicy("Delete"),
		Snapshot: resourceUpdateReplacePolicy("Snapshot"),
		Retain:   resourceUpdateReplacePolicy("Retain"),
	}
)

Functions

This section is empty.

Types

type Expression

type Expression[T any] interface {
	Expression(T)
	json.Marshaler
}

Expression describes a template expression.

func GetAtt

func GetAtt[T any](logicalNameOfResource, attributeName Expression[string]) Expression[T]

GetAtt returns an Expression[T] tha resolves to the Fn::GetAtt intrinsic function. It works for attributes that return a single value. Note that if the "AWS::LanguageExtensions" transform is not enabled, the parameters can only be a constant value.

func Join

func Join(delimiter string, values ExpressionSlice[string]) Expression[string]

Join returns an Expression[string] that resolves to the Fn::Join intrinsic function.

func N

func N[T any]() Expression[T]

N returns an Expression[T] that explicitly resolves to "null" instead of omitting the field when marshaled to JSON.

func Ref

func Ref(logicalName Expression[string]) Expression[string]

Ref is an Expression[string] that resolves to the Ref intrinsic function. Note that if the "AWS::LanguageExtensions" transform is not enabled, "logicalName" can only be a constant value.

func Sub

func Sub(str string) Expression[string]

Sub returns an Expression[string] that resolves to the Fn::Sub intrinsic function (without a key-value map).

func V

func V[T any](value T) Expression[T]

V returns an Expression[T] that resolves to a constant value.

type ExpressionMap

type ExpressionMap[T any] interface {
	ExpressionMap(T)
	GetShallowCopy() ExpressionMap[T]
	json.Marshaler
}

ExpressionMap describes a map of (string, Expression[T]).

type ExpressionSlice

type ExpressionSlice[T any] interface {
	ExpressionSlice(T)
	GetShallowCopy() ExpressionSlice[T]
	json.Marshaler
}

ExpressionSlice describes a slice of Expression[T].

func GetAttSlice

func GetAttSlice[T any](logicalNameOfResource, attributeName Expression[string]) ExpressionSlice[T]

GetAttSlice returns an ExpressionSlice[T] that resolves to the Fn::GetAtt intrinsic function. It works for attributes that return a List of values. Note that if the "AWS::LanguageExtensions" transform is not enabled, the parameters can only be a constant value.

type Map

type Map[T any] map[string]Expression[T]

Map is a map type that implements ExpressionMap[T].

func M

func M[T any](maps ...map[string]Expression[T]) Map[T]

M returns a Map[T] with the given elements merged into one map.

func MV

func MV[T any](maps ...map[string]T) Map[T]

MV returns a Map[T] with the given constant values merged into one map.

func (Map[T]) ExpressionMap

func (Map[T]) ExpressionMap(_ T)

ExpressionMap implements the ExpressionMap[T] interface.

func (Map[T]) GetShallowCopy

func (e Map[T]) GetShallowCopy() ExpressionMap[T]

GetShallowCopy implements the ExpressionMap[T] interface.

func (Map[T]) MarshalJSON

func (e Map[T]) MarshalJSON() ([]byte, error)

MarshalJSON implements the ExpressionMap[T] interface.

type Output

type Output interface {
	OutputPartialLogicalName
	json.Marshaler
}

Output describes a CloudFormation output.

type OutputImpl

type OutputImpl[T any] struct {
	LogicalName string             `json:"-"`
	Description string             `json:"-"`
	Value       Expression[T]      `json:"-"`
	ExportName  Expression[string] `json:"-"`
}

OutputImpl is a provided implementation for an output whose value is resolved by an Expression[T].

func NewOutput

func NewOutput[T any](logicalName string, value Expression[T]) *OutputImpl[T]

NewOutput initializes a new output whose value is resolved by an Expression[T].

func (*OutputImpl[T]) GetOutputLogicalName

func (o *OutputImpl[T]) GetOutputLogicalName() string

GetOutputLogicalName implements the Output interface.

func (*OutputImpl[T]) MarshalJSON

func (o *OutputImpl[T]) MarshalJSON() ([]byte, error)

MarshalJSON implements the Output interface.

func (*OutputImpl[T]) MaybeSetConventionalExportName

func (o *OutputImpl[T]) MaybeSetConventionalExportName(isExported bool) *OutputImpl[T]

MaybeSetConventionalExportName is like SetConventionalExportName but only applied if "isExported" is true.

func (*OutputImpl[T]) SetConventionalExportName

func (o *OutputImpl[T]) SetConventionalExportName() *OutputImpl[T]

SetConventionalExportName sets the export name to "${AWS::StackName}-<current value of LogicalName>".

func (*OutputImpl[T]) SetDescription

func (o *OutputImpl[T]) SetDescription(description string) *OutputImpl[T]

SetDescription sets the description.

func (*OutputImpl[T]) SetExportName

func (o *OutputImpl[T]) SetExportName(exportName Expression[string]) *OutputImpl[T]

SetExportName sets the export name.

func (*OutputImpl[T]) SetLogicalName

func (o *OutputImpl[T]) SetLogicalName(logicalName string) *OutputImpl[T]

SetLogicalName sets the logical name.

func (*OutputImpl[T]) SetVExportName

func (o *OutputImpl[T]) SetVExportName(exportName string) *OutputImpl[T]

SetVExportName sets the export name.

func (*OutputImpl[T]) SetValue

func (o *OutputImpl[T]) SetValue(value Expression[T]) *OutputImpl[T]

SetValue sets the value.

type OutputMapImpl

type OutputMapImpl[T any] struct {
	LogicalName string             `json:"-"`
	Description string             `json:"-"`
	Value       ExpressionMap[T]   `json:"-"`
	ExportName  Expression[string] `json:"-"`
}

OutputMapImpl is a provided implementation for an output whose value is resolved by an ExpressionMap[T].

func NewOutputMap

func NewOutputMap[T any](logicalName string, value ExpressionMap[T]) *OutputMapImpl[T]

NewOutputMap initializes a new output whose value is resolved by an ExpressionMap[T].

func (*OutputMapImpl[T]) GetOutputLogicalName

func (o *OutputMapImpl[T]) GetOutputLogicalName() string

GetOutputLogicalName returns the logical name of the output.

func (*OutputMapImpl[T]) MarshalJSON

func (o *OutputMapImpl[T]) MarshalJSON() ([]byte, error)

MarshalJSON marshals the output.

func (*OutputMapImpl[T]) MaybeSetConventionalExportName

func (o *OutputMapImpl[T]) MaybeSetConventionalExportName(isExported bool) *OutputMapImpl[T]

MaybeSetConventionalExportName is like SetConventionalExportName but only applied if "isExported" is true.

func (*OutputMapImpl[T]) SetConventionalExportName

func (o *OutputMapImpl[T]) SetConventionalExportName() *OutputMapImpl[T]

SetConventionalExportName sets the export name to "${AWS::StackName}-<current value of LogicalName>".

func (*OutputMapImpl[T]) SetDescription

func (o *OutputMapImpl[T]) SetDescription(description string) *OutputMapImpl[T]

SetDescription sets the description.

func (*OutputMapImpl[T]) SetExportName

func (o *OutputMapImpl[T]) SetExportName(exportName Expression[string]) *OutputMapImpl[T]

SetExportName sets the export name.

func (*OutputMapImpl[T]) SetLogicalName

func (o *OutputMapImpl[T]) SetLogicalName(logicalName string) *OutputMapImpl[T]

SetLogicalName sets the logical name.

func (*OutputMapImpl[T]) SetVExportName

func (o *OutputMapImpl[T]) SetVExportName(exportName string) *OutputMapImpl[T]

SetVExportName sets the export name.

func (*OutputMapImpl[T]) SetValue

func (o *OutputMapImpl[T]) SetValue(value ExpressionMap[T]) *OutputMapImpl[T]

SetValue sets the value.

type OutputPartialLogicalName

type OutputPartialLogicalName interface {
	GetOutputLogicalName() string
}

OutputPartialLogicalName describes a subset of a CloudFormation output.

type OutputSliceImpl

type OutputSliceImpl[T any] struct {
	LogicalName string             `json:"-"`
	Description string             `json:"-"`
	Value       ExpressionSlice[T] `json:"-"`
	ExportName  Expression[string] `json:"-"`
}

OutputSliceImpl is a provided implementation for an output whose value is resolved by an ExpressionSlice[T].

func NewOutputSlice

func NewOutputSlice[T any](logicalName string, value ExpressionSlice[T]) *OutputSliceImpl[T]

NewOutputSlice initializes a new output whose value is resolved by an ExpressionSlice[T].

func (*OutputSliceImpl[T]) GetOutputLogicalName

func (o *OutputSliceImpl[T]) GetOutputLogicalName() string

GetOutputLogicalName returns the logical name of the output.

func (*OutputSliceImpl[T]) MarshalJSON

func (o *OutputSliceImpl[T]) MarshalJSON() ([]byte, error)

MarshalJSON marshals the output.

func (*OutputSliceImpl[T]) MaybeSetConventionalExportName

func (o *OutputSliceImpl[T]) MaybeSetConventionalExportName(isExported bool) *OutputSliceImpl[T]

MaybeSetConventionalExportName is like SetConventionalExportName but only applied if "isExported" is true.

func (*OutputSliceImpl[T]) SetConventionalExportName

func (o *OutputSliceImpl[T]) SetConventionalExportName() *OutputSliceImpl[T]

SetConventionalExportName sets the export name to "${AWS::StackName}-<current value of LogicalName>".

func (*OutputSliceImpl[T]) SetDescription

func (o *OutputSliceImpl[T]) SetDescription(description string) *OutputSliceImpl[T]

SetDescription sets the description.

func (*OutputSliceImpl[T]) SetExportName

func (o *OutputSliceImpl[T]) SetExportName(exportName Expression[string]) *OutputSliceImpl[T]

SetExportName sets the export name.

func (*OutputSliceImpl[T]) SetLogicalName

func (o *OutputSliceImpl[T]) SetLogicalName(logicalName string) *OutputSliceImpl[T]

SetLogicalName sets the logical name.

func (*OutputSliceImpl[T]) SetVExportName

func (o *OutputSliceImpl[T]) SetVExportName(exportName string) *OutputSliceImpl[T]

SetVExportName sets the export name.

func (*OutputSliceImpl[T]) SetValue

func (o *OutputSliceImpl[T]) SetValue(value ExpressionSlice[T]) *OutputSliceImpl[T]

SetValue sets the value.

type Resource

type Resource interface {
	ResourcePartialLogicalName
	GetType() string
	GetRequestedOutputs() []Output
	json.Marshaler
}

Resource describes a CloudFormation resource.

type ResourceDeletionPolicy

type ResourceDeletionPolicy interface {
	GetResourceDeletionPolicy() string
	json.Marshaler
}

ResourceDeletionPolicy describes a CloudFormation resource deletion policy.

type ResourceLogicalName

type ResourceLogicalName string

ResourceLogicalName is a string that implements the ResourcePartialLogicalName interface.

func (ResourceLogicalName) GetResourceLogicalName

func (r ResourceLogicalName) GetResourceLogicalName() string

GetResourceLogicalName implements the ResourcePartialLogicalName interface.

type ResourcePartialLogicalName

type ResourcePartialLogicalName interface {
	GetResourceLogicalName() string
}

ResourcePartialLogicalName describes a subset of a CloudFormation resource.

type ResourceUpdateReplacePolicy

type ResourceUpdateReplacePolicy interface {
	GetResourceUpdateReplacePolicy() string
	json.Marshaler
}

ResourceUpdateReplacePolicy describes a CloudFormation resource update replace policy.

type Slice

type Slice[T any] []Expression[T]

Slice is a slice type that implements ExpressionSlice[T].

func S

func S[T any](items ...Expression[T]) Slice[T]

S returns a Slice[T] with the given elements.

func STV

func STV(tagsMap map[string]string) Slice[Tag]

STV returns a Slice[Tag] with the given elements.

func SV

func SV[T any](items ...T) Slice[T]

SV returns a Slice[T] with the given constant values as elements.

func (Slice[T]) ExpressionSlice

func (Slice[T]) ExpressionSlice(_ T)

ExpressionSlice implements the ExpressionSlice[T] interface.

func (Slice[T]) GetShallowCopy

func (e Slice[T]) GetShallowCopy() ExpressionSlice[T]

GetShallowCopy implements the ExpressionSlice[T] interface.

func (Slice[T]) MarshalJSON

func (e Slice[T]) MarshalJSON() ([]byte, error)

MarshalJSON implements the ExpressionSlice[T] interface.

type Tag

type Tag struct {
	// Key is a property.
	Key Expression[string] `json:"Key,omitempty"`

	// Value is a property.
	Value Expression[string] `json:"Value,omitempty"`
}

Tag is a structured type used widely across many CloudFormation resources. It is actually defined in the spec, but for convenience we provide a manually crafted implementation here. See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html

type Template

type Template struct {
	// contains filtered or unexported fields
}

Template describes a template.

func NewTemplate

func NewTemplate() *Template

NewTemplate initializes a new template.

func (*Template) AddOutput

func (t *Template) AddOutput(o Output) error

AddOutput adds an output to the template.

func (*Template) AddResource

func (t *Template) AddResource(r Resource) error

AddResource adds a resource to the template.

func (*Template) MarshalJSON

func (t *Template) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Template) MustAddResource

func (t *Template) MustAddResource(r Resource) *Template

MustAddResource is like AddResource, but panics on error.

Jump to

Keyboard shortcuts

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