format

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package format contains functionality to render a cft.Template into YAML or JSON

Index

Constants

This section is empty.

Variables

View Source
var NodeStyle string

Global, set by command arg --node-style

View Source
var NodeStyleDocs = "Set the node output style to tagged, doublequoted, singlequoted, literal, folded, quotescalars, original, or flow"
View Source
var PklPackageAlias string = "@cfn"

Functions

func CftToPkl added in v1.8.2

func CftToPkl(t cft.Template) (string, error)

CftToPkl serializes the template as pkl. It assumes that the user is import the cloudformation package

func CftToYaml added in v1.7.0

func CftToYaml(t cft.Template) string

CftToYaml converts a template to a YAML string

func CheckMultilineBegin added in v1.6.0

func CheckMultilineBegin(s string) bool

func Jsonise added in v1.7.0

func Jsonise(node *yaml.Node) interface{}

func PrettyPrint added in v1.3.0

func PrettyPrint(i interface{}) string

converts struct to a JSON formatted string

func String

func String(t cft.Template, opt Options) string

String returns a string representation of the supplied cft.Template

func ToJson added in v1.7.5

func ToJson(i interface{}, indent string) ([]byte, error)

ToJson overrides the default behavior of json.Marshal to leave < > alone

Types

type MapItem added in v1.7.5

type MapItem struct {
	Key, Value interface{}
	// contains filtered or unexported fields
}

MapItem representation of one map item.

func (MapItem) String added in v1.7.5

func (mi MapItem) String() string

MapItem as a string.

func (*MapItem) UnmarshalJSON added in v1.7.5

func (mi *MapItem) UnmarshalJSON(b []byte) error

UnmarshalJSON for map item.

type MapSlice added in v1.7.5

type MapSlice []MapItem

MapSlice of map items.

func (MapSlice) Len added in v1.7.5

func (ms MapSlice) Len() int

func (MapSlice) Less added in v1.7.5

func (ms MapSlice) Less(i, j int) bool

func (MapSlice) MarshalJSON added in v1.7.5

func (ms MapSlice) MarshalJSON() ([]byte, error)

MarshalJSON for map slice.

func (MapSlice) Swap added in v1.7.5

func (ms MapSlice) Swap(i, j int)

func (*MapSlice) UnmarshalJSON added in v1.7.5

func (ms *MapSlice) UnmarshalJSON(b []byte) error

UnmarshalJSON for map slice.

type Options

type Options struct {
	// JSON determines whether the outputs will be JSON (true) or YAML (false)
	JSON bool

	// Unsorted will cause the formatter to leave the ordering of template elements
	// as in the original template if true.
	// If false, the formatter will rearrange the template elements into
	// canonical order.
	Unsorted bool
}

Options contains options for formatting cfn templates

Jump to

Keyboard shortcuts

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