parser

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIntrinsic

func IsIntrinsic(key string) bool

IsIntrinsic ...

func IsIntrinsicFunc

func IsIntrinsicFunc(node *yaml.Node) bool

func NewCFReference

func NewCFReference(id string, resourceRange types.Range) types.Reference

NewCFReference ...

func NewCFReferenceWithValue

func NewCFReferenceWithValue(resourceRange types.Range, resolvedValue Property, logicalId string) types.Reference

NewCFReferenceWithValue ...

Types

type CFReference

type CFReference struct {
	// contains filtered or unexported fields
}

CFReference ...

func (*CFReference) Comment added in v0.2.0

func (cf *CFReference) Comment() string

func (*CFReference) DisplayValue added in v0.2.0

func (cf *CFReference) DisplayValue() string

func (*CFReference) LogicalID added in v0.0.6

func (cf *CFReference) LogicalID() string

func (*CFReference) PropertyRange added in v0.2.0

func (cf *CFReference) PropertyRange() types.Range

func (*CFReference) RefersTo

func (cf *CFReference) RefersTo(r types.Reference) bool

RefersTo ...

func (*CFReference) ResourceRange

func (cf *CFReference) ResourceRange() types.Range

ResourceRange ...

func (*CFReference) String

func (cf *CFReference) String() string

String ...

type EqualityOptions

type EqualityOptions = int

EqualityOptions ...

const (
	IgnoreCase EqualityOptions = iota
)

IgnoreCase ...

type ErrInvalidContent added in v0.2.0

type ErrInvalidContent struct {
	// contains filtered or unexported fields
}

func NewErrInvalidContent added in v0.2.0

func NewErrInvalidContent(source string, err error) *ErrInvalidContent

func (*ErrInvalidContent) Error added in v0.2.0

func (e *ErrInvalidContent) Error() string

func (*ErrInvalidContent) Reason added in v0.2.0

func (e *ErrInvalidContent) Reason() error

type ErrNotCloudFormation

type ErrNotCloudFormation struct {
	// contains filtered or unexported fields
}

func NewErrNotCloudFormation

func NewErrNotCloudFormation(source string) *ErrNotCloudFormation

func (*ErrNotCloudFormation) Error

func (e *ErrNotCloudFormation) Error() string

type ErrParsingErrors added in v0.2.0

type ErrParsingErrors struct {
	// contains filtered or unexported fields
}

func NewErrParsingErrors added in v0.2.0

func NewErrParsingErrors(errs []error) *ErrParsingErrors

func (*ErrParsingErrors) Error added in v0.2.0

func (e *ErrParsingErrors) Error() string

type FileContext

type FileContext struct {
	SourceFormat SourceFormat
	Parameters   map[string]*Parameter  `json:"Parameters" yaml:"Parameters"`
	Resources    map[string]*Resource   `json:"Resources" yaml:"Resources"`
	Globals      map[string]*Resource   `json:"Globals" yaml:"Globals"`
	Mappings     map[string]interface{} `json:"Mappings,omitempty" yaml:"Mappings"`
	// contains filtered or unexported fields
}

FileContext ...

func (*FileContext) GetResourceByLogicalID

func (t *FileContext) GetResourceByLogicalID(name string) *Resource

func (*FileContext) GetResourceByType

func (t *FileContext) GetResourceByType(names ...string) []*Resource

GetResourceByType ...

func (*FileContext) Metadata

func (t *FileContext) Metadata() types.Metadata

Metadata ...

type FileContexts

type FileContexts []*FileContext

FileContexts ...

type Option

type Option func(p *Parser)

func ProvidedParametersOption

func ProvidedParametersOption(parameters string) Option

type Parameter

type Parameter struct {
	// contains filtered or unexported fields
}

Parameter ...

func (*Parameter) Default

func (p *Parameter) Default() interface{}

Default ...

func (*Parameter) Type

func (p *Parameter) Type() cftypes.CfType

Type ...

func (*Parameter) UnmarshalJSONWithMetadata

func (p *Parameter) UnmarshalJSONWithMetadata(node jfather.Node) error

UnmarshalJSONWithMetadata ...

func (*Parameter) UnmarshalYAML

func (p *Parameter) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML ...

func (*Parameter) UpdateDefault

func (p *Parameter) UpdateDefault(inVal interface{})

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser ...

func NewParser

func NewParser(options ...Option) *Parser

func (*Parser) Parse

func (p *Parser) Parse(reader io.Reader, source string) (*FileContext, error)

Parse parses content from an io.Reader, which may not necessarily be a traditional file. the 'source' argument should identify the source of the content, be it a url, a filesystem path, a container etc.

func (*Parser) ParseDirectory

func (p *Parser) ParseDirectory(dir string) (FileContexts, error)

ParseDirectory ...

func (*Parser) ParseFiles

func (p *Parser) ParseFiles(filepaths ...string) (FileContexts, error)

ParseFiles ...

type Property

type Property struct {
	Inner PropertyInner
	// contains filtered or unexported fields
}

Property ...

func GetAzs

func GetAzs(property *Property) (*Property, bool)

func GetCidr

func GetCidr(property *Property) (*Property, bool)

func PassthroughResolution

func PassthroughResolution(property *Property) (*Property, bool)

func ResolveBase64

func ResolveBase64(property *Property) (*Property, bool)

ResolveBase64 ...

func ResolveEquals

func ResolveEquals(property *Property) (resolved *Property, success bool)

ResolveEquals ...

func ResolveFindInMap

func ResolveFindInMap(property *Property) (resolved *Property, success bool)

func ResolveGetAtt

func ResolveGetAtt(property *Property) (resolved *Property, success bool)

ResolveGetAtt ...

func ResolveIntrinsicFunc

func ResolveIntrinsicFunc(property *Property) (*Property, bool)

ResolveIntrinsicFunc ...

func ResolveJoin

func ResolveJoin(property *Property) (resolved *Property, success bool)

ResolveJoin ...

func ResolveReference

func ResolveReference(property *Property) (resolved *Property, success bool)

ResolveReference ...

func ResolveSelect

func ResolveSelect(property *Property) (resolved *Property, success bool)

ResolveSelect attempts to resolve the value from a Fn::Select with a Property

func ResolveSplit

func ResolveSplit(property *Property) (resolved *Property, success bool)

ResolveSplit ...

func ResolveSub

func ResolveSub(property *Property) (resolved *Property, success bool)

ResolveSub attempts to resolve the value of a string with substitutions with a Property

func (*Property) AsBool

func (p *Property) AsBool() bool

AsBool ...

func (*Property) AsBoolValue

func (p *Property) AsBoolValue() types.BoolValue

AsBoolValue ...

func (*Property) AsInt

func (p *Property) AsInt() int

AsInt ...

func (*Property) AsIntValue

func (p *Property) AsIntValue() types.IntValue

AsIntValue ...

func (*Property) AsList

func (p *Property) AsList() []*Property

AsList ...

func (*Property) AsMap

func (p *Property) AsMap() map[string]*Property

AsMap ...

func (*Property) AsRawStrings

func (p *Property) AsRawStrings() ([]string, error)

AsRawStrings ...

func (*Property) AsString

func (p *Property) AsString() string

AsString ...

func (*Property) AsStringValue

func (p *Property) AsStringValue() types.StringValue

AsStringValue ...

func (*Property) BoolDefault

func (p *Property) BoolDefault(defaultValue bool) types.BoolValue

BoolDefault ...

func (*Property) Comment

func (p *Property) Comment() string

func (*Property) Contains

func (p *Property) Contains(checkVal interface{}) bool

Contains ...

func (*Property) ConvertTo

func (p *Property) ConvertTo(conversionType cftypes.CfType) *Property

func (*Property) EqualTo

func (p *Property) EqualTo(checkValue interface{}, equalityOptions ...EqualityOptions) bool

EqualTo ...

func (*Property) GetBoolProperty

func (p *Property) GetBoolProperty(path string, defaultValue ...bool) types.BoolValue

GetBoolProperty ...

func (*Property) GetIntProperty

func (p *Property) GetIntProperty(path string, defaultValue ...int) types.IntValue

GetIntProperty ...

func (*Property) GetProperty

func (p *Property) GetProperty(path string) *Property

GetProperty takes a path to the property separated by '.' and returns the resolved value

func (*Property) GetStringProperty

func (p *Property) GetStringProperty(path string, defaultValue ...string) types.StringValue

GetStringProperty ...

func (*Property) IntDefault

func (p *Property) IntDefault(defaultValue int) types.IntValue

IntDefault ...

func (*Property) IsBool

func (p *Property) IsBool() bool

IsBool ...

func (*Property) IsConvertableTo

func (p *Property) IsConvertableTo(conversionType cftypes.CfType) bool

func (*Property) IsEmpty

func (p *Property) IsEmpty() bool

IsEmpty ...

func (*Property) IsInt

func (p *Property) IsInt() bool

IsInt ...

func (*Property) IsList

func (p *Property) IsList() bool

IsList ...

func (*Property) IsMap

func (p *Property) IsMap() bool

IsMap ...

func (*Property) IsNil

func (p *Property) IsNil() bool

IsNil ...

func (*Property) IsNotBool

func (p *Property) IsNotBool() bool

IsNotBool ...

func (*Property) IsNotInt

func (p *Property) IsNotInt() bool

IsNotInt ...

func (*Property) IsNotList

func (p *Property) IsNotList() bool

IsNotList ...

func (*Property) IsNotMap

func (p *Property) IsNotMap() bool

IsNotMap ...

func (*Property) IsNotNil

func (p *Property) IsNotNil() bool

IsNotNil ...

func (*Property) IsNotString

func (p *Property) IsNotString() bool

IsNotString ...

func (*Property) IsString

func (p *Property) IsString() bool

IsString ...

func (*Property) IsTrue

func (p *Property) IsTrue() bool

IsTrue ...

func (*Property) Metadata

func (p *Property) Metadata() types.Metadata

Metadata ...

func (*Property) MetadataWithValue

func (p *Property) MetadataWithValue(resolvedValue *Property) types.Metadata

MetadataWithValue ...

func (*Property) ParentRange added in v0.2.0

func (p *Property) ParentRange() types.Range

func (*Property) Range

func (p *Property) Range() types.Range

Range ...

func (*Property) RawValue

func (p *Property) RawValue() interface{}

RawValue returns the value as an interface

func (*Property) SetLogicalResource added in v0.0.7

func (p *Property) SetLogicalResource(id string)

func (*Property) String

func (p *Property) String() string

func (*Property) StringDefault

func (p *Property) StringDefault(defaultValue string) types.StringValue

StringDefault ...

func (*Property) Type

func (p *Property) Type() cftypes.CfType

Type ...

func (*Property) UnmarshalJSONWithMetadata

func (p *Property) UnmarshalJSONWithMetadata(node jfather.Node) error

UnmarshalJSONWithMetadata ...

func (*Property) UnmarshalYAML

func (p *Property) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML ...

type PropertyInner

type PropertyInner struct {
	Type  cftypes.CfType
	Value interface{} `json:"Value" yaml:"Value"`
}

PropertyInner ...

type Resource

type Resource struct {
	Inner ResourceInner
	// contains filtered or unexported fields
}

Resource ...

func (*Resource) BoolDefault

func (r *Resource) BoolDefault(defaultValue bool) types.BoolValue

BoolDefault ...

func (*Resource) ConfigureResource

func (r *Resource) ConfigureResource(id, filepath string, ctx *FileContext)

ConfigureResource ...

func (*Resource) GetBoolProperty

func (r *Resource) GetBoolProperty(path string, defaultValue ...bool) types.BoolValue

GetBoolProperty ...

func (*Resource) GetIntProperty

func (r *Resource) GetIntProperty(path string, defaultValue ...int) types.IntValue

GetIntProperty ...

func (*Resource) GetProperty

func (r *Resource) GetProperty(path string) *Property

GetProperty takes a path to the property separated by '.' and returns the resolved value

func (*Resource) GetStringProperty

func (r *Resource) GetStringProperty(path string, defaultValue ...string) types.StringValue

GetStringProperty ...

func (*Resource) ID

func (r *Resource) ID() string

ID ...

func (*Resource) IntDefault

func (r *Resource) IntDefault(defaultValue int) types.IntValue

IntDefault ...

func (*Resource) IsNil

func (r *Resource) IsNil() bool

IsNil ...

func (*Resource) Metadata

func (r *Resource) Metadata() types.Metadata

Metadata ...

func (*Resource) Range

func (r *Resource) Range() types.Range

Range ...

func (*Resource) SourceFormat

func (r *Resource) SourceFormat() SourceFormat

SourceFormat ...

func (*Resource) StringDefault

func (r *Resource) StringDefault(defaultValue string) types.StringValue

StringDefault ...

func (*Resource) Type

func (r *Resource) Type() string

Type ...

func (*Resource) UnmarshalJSONWithMetadata

func (r *Resource) UnmarshalJSONWithMetadata(node jfather.Node) error

UnmarshalJSONWithMetadata ...

func (*Resource) UnmarshalYAML

func (r *Resource) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML ...

type ResourceInner

type ResourceInner struct {
	Type       string               `json:"Type" yaml:"Type"`
	Properties map[string]*Property `json:"Properties" yaml:"Properties"`
}

ResourceInner ...

type SourceFormat

type SourceFormat string

SourceFormat ...

const (
	YamlSourceFormat SourceFormat = "yaml"
	JsonSourceFormat SourceFormat = "json"
)

YamlSourceFormat ...

Jump to

Keyboard shortcuts

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