template

package
v0.157.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

View Source
const (
	AccountID        = "AWS::AccountId"
	NotificationARNs = "AWS::NotificationARNs"
	NoValue          = "AWS::NoValue"
	Partition        = "AWS::Partition"
	Region           = "AWS::Region"
	StackID          = "AWS::StackId"
	StackName        = "AWS::StackName"

	Ref           = "Ref"
	FnBase64      = "Fn::Base64"
	FnCIDR        = "Fn::Cidr"
	FnAnd         = "Fn::And"
	FnEquals      = "Fn::Equals"
	FnIf          = "Fn::If"
	FnNot         = "Fn::Not"
	FnOr          = "Fn::Or"
	FnFindInMap   = "Fn::FindInMap"
	FnGetAtt      = "Fn::GetAtt"
	FnGetAZs      = "Fn::GetAZs"
	FnImportValue = "Fn::ImportValue"
	FnJoin        = "Fn::Join"
	FnSub         = "Fn::Sub"
	FnSelect      = "Fn::Select"
	FnSplit       = "Fn::Split"
)

Commonly-used constants

View Source
const (
	AWSTemplateFormatVersion = "2010-09-09"
)

Commonly-used constants

Variables

View Source
var (
	RefAccountID        = MakeRef(AccountID)
	RefNotificationARNs = MakeRef(NotificationARNs)
	RefNoValue          = MakeRef(NoValue)
	RefPartition        = MakeRef(Partition)
	RefRegion           = MakeRef(Region)
	RefStackID          = MakeRef(StackID)
	RefStackName        = MakeRef(StackName)
)

Commonly-used references

Functions

This section is empty.

Types

type AnyResource

type AnyResource struct {
	Type       string
	Properties interface{}
}

AnyResource represents a generic CloudFormation resource

type AnythingMap

type AnythingMap MapOfInterfaces

AnythingMap is an extension of map[string]interface{} type

func (AnythingMap) Convert

func (v AnythingMap) Convert(obj interface{}) error

Convert will serialise the receiver as JSON, and deserialise it into obj

func (AnythingMap) MarshalJSON

func (v AnythingMap) MarshalJSON() ([]byte, error)

MarshalJSON serialises the value as JSON data

type AnythingSlice

type AnythingSlice SliceOfInterfaces

AnythingSlice is an extension of []interface{} type

func (AnythingSlice) Convert

func (v AnythingSlice) Convert(obj interface{}) error

Convert will serialise the receiver as JSON, and deserialise it into obj

func (AnythingSlice) MarshalJSON

func (v AnythingSlice) MarshalJSON() ([]byte, error)

MarshalJSON serialises the value as JSON data

type Boolean

type Boolean bool

Boolean is an extension of bool type

func (Boolean) MarshalJSON

func (v Boolean) MarshalJSON() ([]byte, error)

MarshalJSON serialises the value as JSON data

type Double

type Double float64

Double is an extension of float64 type

func (Double) MarshalJSON

func (v Double) MarshalJSON() ([]byte, error)

MarshalJSON serialises the value as JSON data

type IAMPolicy

type IAMPolicy struct {
	PolicyName *Value `json:",omitempty"`

	Roles          []*Value        `json:",omitempty"`
	PolicyDocument MapOfInterfaces `json:",omitempty"`
}

IAMPolicy represents a CloudFormation AWS::IAM::Policy resource

func (*IAMPolicy) Properties

func (r *IAMPolicy) Properties() interface{}

Properties will return the properties of the resource

func (*IAMPolicy) Type

func (r *IAMPolicy) Type() string

Type will return the full type name for the resource

type IAMRole

type IAMRole struct {
	RoleName string `json:",omitempty"`

	Path string `json:",omitempty"`

	AssumeRolePolicyDocument MapOfInterfaces `json:",omitempty"`
	ManagedPolicyArns        []interface{}   `json:",omitempty"`
	PermissionsBoundary      string          `json:",omitempty"`
}

IAMRole represents a CloudFormation AWS::IAM::Role resource

func (*IAMRole) Properties

func (r *IAMRole) Properties() interface{}

Properties will return the properties of the resource

func (*IAMRole) Type

func (r *IAMRole) Type() string

Type will return the full type name for the resource

type Integer

type Integer int

Integer is an extension of int type

func (Integer) MarshalJSON

func (v Integer) MarshalJSON() ([]byte, error)

MarshalJSON serialises the value as JSON data

type Intrinsic

type Intrinsic struct {
	Value MapOfInterfaces
}

Intrinsic represents an intrinsics

func (Intrinsic) MarshalJSON

func (v Intrinsic) MarshalJSON() ([]byte, error)

MarshalJSON serialises the value as JSON data

type MapOfInterfaces

type MapOfInterfaces = map[string]interface{}

MapOfInterfaces is an alias for map[string]interface{}

func MakeAssumeRolePolicyDocumentForServices

func MakeAssumeRolePolicyDocumentForServices(services ...*gfn.Value) MapOfInterfaces

MakeAssumeRolePolicyDocumentForServices constructs a trust policy for given services

func MakeAssumeRolePolicyDocumentForServicesWithConditions added in v0.134.0

func MakeAssumeRolePolicyDocumentForServicesWithConditions(condition MapOfInterfaces, services ...*gfn.Value) MapOfInterfaces

MakeAssumeRolePolicyDocumentForServices constructs a trust policy for given services with given conditions

func MakeAssumeRoleWithWebIdentityPolicyDocument

func MakeAssumeRoleWithWebIdentityPolicyDocument(providerARN string, condition MapOfInterfaces) MapOfInterfaces

MakeAssumeRoleWithWebIdentityPolicyDocument constructs a trust policy for given a web identity priovider with given conditions

func MakePolicyDocument

func MakePolicyDocument(statements ...MapOfInterfaces) MapOfInterfaces

MakePolicyDocument constructs a policy with given statements

type Output

type Output struct {
	Value  *Value        `json:",omitempty"`
	Export *OutputExport `json:",omitempty"`
}

Output represents a CloudFormation output definition

type OutputExport

type OutputExport struct {
	Name *Value `json:",omitempty"`
}

OutputExport represents export name of a CloudFormation output

type Resource

type Resource interface {
	Type() string
	Properties() interface{}
}

Resource defines the interface that every resource should implement

type SliceOfInterfaces

type SliceOfInterfaces = []interface{}

SliceOfInterfaces is an alias for []interface{}

type String

type String string

String is a extension of string type

func (String) MarshalJSON

func (v String) MarshalJSON() ([]byte, error)

MarshalJSON serialises the value as JSON data

type StringSlice

type StringSlice []string

StringSlice represents a slice of strings

func (StringSlice) MarshalJSON

func (v StringSlice) MarshalJSON() ([]byte, error)

MarshalJSON serialises the value as JSON data

type Tag

type Tag struct {
	Key   interface{}
	Value interface{}

	PropagateAtLaunch string
}

Tag is a CloudFormation tag

type Template

type Template struct {
	AWSTemplateFormatVersion string

	Description string
	Resources   map[string]AnyResource `json:",omitempty"`
	Outputs     map[string]Output      `json:",omitempty"`
}

Template is a representation of a CloudFormation template

func NewTemplate

func NewTemplate() *Template

NewTemplate constructs a new Template and returns the reference to it

func (*Template) AttachPolicy

func (t *Template) AttachPolicy(name string, refRole *Value, policyDoc MapOfInterfaces)

AttachPolicy attaches the specified policy document

func (*Template) LoadJSON

func (t *Template) LoadJSON(data []byte) error

LoadJSON will deserialise a JSON template

func (*Template) NewResource

func (t *Template) NewResource(name string, resource Resource) *Value

NewResource adds a resource to the template and returns a CloudFormation reference

func (*Template) RenderJSON

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

RenderJSON will serialise the template to JSON

type Value

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

Value represents any JSON value

func False

func False() *Value

False will return a new false value

func MakeFnCIDR

func MakeFnCIDR(arg *Value, n, len int) *Value

MakeFnCIDR constructs an Fn::Cidr intrinsic

func MakeFnGetAtt

func MakeFnGetAtt(arg *Value) *Value

MakeFnGetAtt constructs an Fn::GetAtt intrinsic

func MakeFnGetAttString

func MakeFnGetAttString(arg string) *Value

MakeFnGetAttString constructs an Fn::GetAtt intrinsic for a given string

func MakeFnImportValue

func MakeFnImportValue(arg *Value) *Value

MakeFnImportValue constructs an Fn::ImportValue intrinsic

func MakeFnImportValueString

func MakeFnImportValueString(arg string) *Value

MakeFnImportValueString constructs an Fn::ImportValue intrinsic for a given string

func MakeFnJoin

func MakeFnJoin(sep string, args []*Value) *Value

MakeFnJoin constructs an Fn::Join intrinsic

func MakeFnSelect

func MakeFnSelect(i int, arg *Value) *Value

MakeFnSelect constructs an Fn::Select intrinsic

func MakeFnSplit

func MakeFnSplit(sep string, arg *Value) *Value

MakeFnSplit constructs an Fn::Split intrinsic

func MakeFnSplitString

func MakeFnSplitString(sep string, arg string) *Value

MakeFnSplitString constructs an Fn::Split intrinsic for a given string

func MakeFnSub

func MakeFnSub(arg *Value) *Value

MakeFnSub constructs an Fn::Sub intrinsic

func MakeFnSubString

func MakeFnSubString(arg string) *Value

MakeFnSubString constructs an Fn::Sub intrinsic for a given string

func MakeIntrinsic

func MakeIntrinsic(k string, v interface{}) *Value

MakeIntrinsic constructs an intrinsic

func MakeName

func MakeName(suffix string) *Value

MakeName is syntactic sugar for {"Fn::Sub": "${AWS::Stack}-<name>"}

func MakeRef

func MakeRef(r string) *Value

MakeRef constructs a Ref intrinsic

func MakeSlice

func MakeSlice(i ...*Value) []*Value

MakeSlice makes a slice from a list of arguments

func MakeStringSlice

func MakeStringSlice(s ...string) []*Value

MakeStringSlice makes a slice from a list of string arguments

func NewBoolean

func NewBoolean(v bool) *Value

NewBoolean creates a Boolean from v

func NewDouble

func NewDouble(v float64) *Value

NewDouble creates a Double from v

func NewInteger

func NewInteger(v int) *Value

NewInteger creates an Integer from v

func NewString

func NewString(v string) *Value

NewString creates a String from v

func NewStringSlice

func NewStringSlice(v ...string) *Value

NewStringSlice constructs a representation of slice of strings from the given arguments

func NewValue

func NewValue(v json.Marshaler) *Value

NewValue create a value

func True

func True() *Value

True will return a new true value

func (Value) MarshalJSON

func (v Value) MarshalJSON() ([]byte, error)

MarshalJSON serialises the value as JSON data

func (*Value) Raw

func (v *Value) Raw() interface{}

Raw returns the value as an empty interface

func (*Value) String

func (v *Value) String() string

String representation of the value

func (*Value) UnmarshalJSON

func (v *Value) UnmarshalJSON(b []byte) error

UnmarshalJSON parses JSON data into a value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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