parse

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Overview

Package parse provides functions for parsing CloudFormation templates from JSON and YAML inputs.

Example
package main

import (
	"fmt"

	"github.com/aws-cloudformation/rain/cft/parse"
)

func main() {
	template, _ := parse.String(`
Resources:
  Bucket:
    Type: AWS::S3::Bucket
`)

	fmt.Println(template.Map())
}
Output:

map[Resources:map[Bucket:map[Type:AWS::S3::Bucket]]]

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func File

func File(fileName string) (cft.Template, error)

File returns a cft.Template parsed from a file specified by fileName

func Map

func Map(input map[string]interface{}) (cft.Template, error)

Map returns a cft.Template parsed from a map[string]interface{}

func Node

func Node(node *yaml.Node) (cft.Template, error)

Node returns a cft.Template parse from a *yaml.Node

func Reader

func Reader(r io.Reader) (cft.Template, error)

Reader returns a cft.Template parsed from an io.Reader

func String

func String(input string) (cft.Template, error)

String returns a cft.Template parsed from a string

func TransformNode added in v1.2.0

func TransformNode(n *yaml.Node) error

TransformNode takes a *yaml.Node and convert tag-style names into map-style, and converts other scalars into a canonical format

func Verify

func Verify(source cft.Template, output string) error

Verify confirms that there is no semantic difference between the source cft.Template and the string representation in output. This can be used to ensure that the parse package hasn't done anything unexpected to your template.

Types

This section is empty.

Jump to

Keyboard shortcuts

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