cft

package
v1.8.6 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: 6 Imported by: 7

Documentation

Overview

Package cft provides the Template type that models a CloudFormation template.

The sub-packages of cft contain various tools for working with templates

Index

Constants

This section is empty.

Variables

View Source
var Tags = map[string]string{
	"!And":           "Fn::And",
	"!Base64":        "Fn::Base64",
	"!Cidr":          "Fn::Cidr",
	"!Equals":        "Fn::Equals",
	"!FindInMap":     "Fn::FindInMap",
	"!GetAZs":        "Fn::GetAZs",
	"!GetAtt":        "Fn::GetAtt",
	"!If":            "Fn::If",
	"!ImportValue":   "Fn::ImportValue",
	"!Join":          "Fn::Join",
	"!Not":           "Fn::Not",
	"!Or":            "Fn::Or",
	"!Select":        "Fn::Select",
	"!Split":         "Fn::Split",
	"!Sub":           "Fn::Sub",
	"!Ref":           "Ref",
	"!Condition":     "Condition",
	"!Rain::Embed":   "Rain::Embed",
	"!Rain::Include": "Rain::Include",
	"!Rain::Env":     "Rain::Env",
	"!Rain::S3Http":  "Rain::S3Http",
	"!Rain::S3":      "Rain::S3",
	"!Rain::Module":  "Rain::Module",
}

Tags is a mapping from YAML short tags to full instrincic function names

Functions

func AppendStateMap added in v1.7.0

func AppendStateMap(state Template) *yaml.Node

AppendStateMap appends a "State" section to the template

Types

type Comment

type Comment struct {
	Path  []interface{}
	Value string
}

Comment represents a path to a node and a comment string to attach to it

type Section added in v1.8.0

type Section string

Section represents a top level section of a template, like Resources

const (
	AWSTemplateFormatVersion Section = "AWSTemplateFormatVersion"
	Resources                Section = "Resources"
	Description              Section = "Description"
	Metadata                 Section = "Metadata"
	Parameters               Section = "Parameters"
	Rules                    Section = "Rules"
	Mappings                 Section = "Mappings"
	Conditions               Section = "Conditions"
	Transform                Section = "Transform"
	Outputs                  Section = "Outputs"
	State                    Section = "State"
)

type Template

type Template struct {
	*yaml.Node
}

Template represents a CloudFormation template. The Template type is minimal for now but will likely grow new features as needed by rain.

func (Template) AddComments

func (t Template) AddComments(comments []*Comment) error

AddComments applies a set of comments to the template

func (Template) AddMapSection added in v1.8.0

func (t Template) AddMapSection(section Section) (*yaml.Node, error)

AddMapSection adds a section like Resources to the template

func (Template) AddScalarSection added in v1.8.0

func (t Template) AddScalarSection(section Section, val string) error

AddScalarSection adds a section like Description to the template

func (Template) GetNode added in v1.8.0

func (t Template) GetNode(section Section, name string) (*yaml.Node, error)

GetNode returns a yaml node by section and name

func (Template) GetParameter added in v1.8.0

func (t Template) GetParameter(name string) (*yaml.Node, error)

GetParameter returns the yaml node for a parameter by name

func (Template) GetResource added in v1.8.0

func (t Template) GetResource(name string) (*yaml.Node, error)

GetResource returns the yaml node for a resource by logical id

func (Template) GetSection added in v1.8.0

func (t Template) GetSection(section Section) (*yaml.Node, error)

GetSection returns the yaml node for the section

func (Template) GetTypes added in v1.8.0

func (t Template) GetTypes() ([]string, error)

GetTypes returns all unique type names for resources in the template

func (Template) Map

func (t Template) Map() map[string]interface{}

Map returns the template as a map[string]interface{}

Directories

Path Synopsis
Package diff provides the Diff class that can be used to compare CloudFormation templates
Package diff provides the Diff class that can be used to compare CloudFormation templates
Package format contains functionality to render a cft.Template into YAML or JSON
Package format contains functionality to render a cft.Template into YAML or JSON
Package graph provides functionality to build a graph of connected nodes with a cfn.Template
Package graph provides functionality to build a graph of connected nodes with a cfn.Template
Package parse provides functions for parsing CloudFormation templates from JSON and YAML inputs.
Package parse provides functions for parsing CloudFormation templates from JSON and YAML inputs.
This file contains implementations for `!Rain::` directives
This file contains implementations for `!Rain::` directives

Jump to

Keyboard shortcuts

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