format

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package format provides functions for formatting the types found in the cfn package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Anything

func Anything(data interface{}, options Options) string

Anything returns a string representation of any given value as either JSON or YAML depending on options.Style

func Diff

func Diff(d diff.Diff, options Options) string

Diff returns a string representation of a diff.Diff. options.Style is currently ignored and the format will be annotated YAML

func SortKeys

func SortKeys(keys []string, path []interface{}) []string

SortKeys sorts the given keys based on their location within a CloudFormation template as given by the path parameter

func Template

func Template(t cfn.Template, options Options) string

Template returns a string representation of a cfn.Template as either JSON or YAML depending on options.Style

Types

type Options

type Options struct {
	Style    Style
	Compact  bool
	Comments map[interface{}]interface{}
}

Options represents a collection of formatting options

type Style

type Style int

Style represents a style offered by a given formatter

const (
	YAML Style = iota
	JSON
)

Jump to

Keyboard shortcuts

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