cft

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 7 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",
	"!Rain::Constant": "Rain::Constant",
}

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 PackageAlias added in v1.20.0

type PackageAlias struct {
	// Alias is a simple string like "aws"
	Alias string

	// Location is the URI where the package is stored
	Location string

	// Hash is an optional hash for zipped packages hosted on a URL
	Hash string
}

PackageAlias is an alias to a module package location A Rain package is a directory of modules, which are single yaml files. See the main README for more

type Resource added in v1.16.0

type Resource struct {
	LogicalId string
	Node      *yaml.Node
}

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"
	Rain                     Section = "Rain"
)

type Template

type Template struct {
	Node *yaml.Node

	Constants map[string]*yaml.Node
	Packages  map[string]*PackageAlias
}

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) GetResourcesOfType added in v1.9.0

func (t Template) GetResourcesOfType(typeName string) []*Resource

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{}

func (Template) RemoveSection added in v1.17.0

func (t Template) RemoveSection(section Section) error

RemoveSection removes a section node from the template

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 implements !Rain::Module
This file implements !Rain::Module

Jump to

Keyboard shortcuts

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