parser

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIntrinsic

func IsIntrinsic(key string) bool

func IsIntrinsicFunc

func IsIntrinsicFunc(node *yaml.Node) bool

func NewCFReference

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

func NewCFReferenceWithValue

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

Types

type CFReference

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

func (*CFReference) Comment

func (cf *CFReference) Comment() string

func (*CFReference) DisplayValue

func (cf *CFReference) DisplayValue() string

func (*CFReference) LogicalID

func (cf *CFReference) LogicalID() string

func (*CFReference) PropertyRange

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

func (*CFReference) RefersTo

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

func (*CFReference) ResourceRange

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

func (*CFReference) String

func (cf *CFReference) String() string

type EqualityOptions

type EqualityOptions = int
const (
	IgnoreCase EqualityOptions = iota
)

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
}

func (*FileContext) GetResourceByLogicalID

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

func (*FileContext) GetResourcesByType

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

func (*FileContext) Metadata

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

type FileContexts

type FileContexts []*FileContext

type InvalidContentError

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

func NewErrInvalidContent

func NewErrInvalidContent(source string, err error) *InvalidContentError

func (*InvalidContentError) Error

func (e *InvalidContentError) Error() string

func (*InvalidContentError) Reason

func (e *InvalidContentError) Reason() error

type Parameter

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

func (*Parameter) Default

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

func (*Parameter) Type

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

func (*Parameter) UnmarshalJSONWithMetadata

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

func (*Parameter) UnmarshalYAML

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

func (*Parameter) UpdateDefault

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

type Parser

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

func New

func New(options ...options.ParserOption) *Parser

func (*Parser) ParseFS

func (p *Parser) ParseFS(ctx context.Context, target fs.FS, dir string) (FileContexts, error)

func (*Parser) ParseFile

func (p *Parser) ParseFile(ctx context.Context, fs fs.FS, path string) (context *FileContext, err error)

func (*Parser) Required

func (p *Parser) Required(fs fs.FS, path string) bool

func (*Parser) SetDebugWriter

func (p *Parser) SetDebugWriter(writer io.Writer)

func (*Parser) SetSkipRequiredCheck

func (p *Parser) SetSkipRequiredCheck(b bool)

type Property

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

func GetAzs

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

func GetCidr

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

func ImportPlaceholder

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

func PassthroughResolution

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

func ResolveBase64

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

func ResolveEquals

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

func ResolveFindInMap

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

func ResolveGetAtt

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

func ResolveIntrinsicFunc

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

func ResolveJoin

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

func ResolveReference

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

func ResolveSelect

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

func ResolveSplit

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

func ResolveSub

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

func (*Property) AsBool

func (p *Property) AsBool() bool

func (*Property) AsBoolValue

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

func (*Property) AsInt

func (p *Property) AsInt() int

func (*Property) AsIntValue

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

func (*Property) AsList

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

func (*Property) AsMap

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

func (*Property) AsRawStrings

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

func (*Property) AsString

func (p *Property) AsString() string

func (*Property) AsStringValue

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

func (*Property) BoolDefault

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

func (*Property) Comment

func (p *Property) Comment() string

func (*Property) Contains

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

func (*Property) ConvertTo

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

func (*Property) EqualTo

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

func (*Property) GetBoolProperty

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

func (*Property) GetIntProperty

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

func (*Property) GetJsonBytes

func (p *Property) GetJsonBytes(squashList ...bool) []byte

func (*Property) GetJsonBytesAsString

func (p *Property) GetJsonBytesAsString(squashList ...bool) string

func (*Property) GetProperty

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

func (*Property) GetStringProperty

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

func (*Property) IntDefault

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

func (*Property) IsBool

func (p *Property) IsBool() bool

func (*Property) IsConvertableTo

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

func (*Property) IsEmpty

func (p *Property) IsEmpty() bool

func (*Property) IsInt

func (p *Property) IsInt() bool

func (*Property) IsList

func (p *Property) IsList() bool

func (*Property) IsMap

func (p *Property) IsMap() bool

func (*Property) IsNil

func (p *Property) IsNil() bool

func (*Property) IsNotBool

func (p *Property) IsNotBool() bool

func (*Property) IsNotInt

func (p *Property) IsNotInt() bool

func (*Property) IsNotList

func (p *Property) IsNotList() bool

func (*Property) IsNotMap

func (p *Property) IsNotMap() bool

func (*Property) IsNotNil

func (p *Property) IsNotNil() bool

func (*Property) IsNotString

func (p *Property) IsNotString() bool

func (*Property) IsString

func (p *Property) IsString() bool

func (*Property) IsTrue

func (p *Property) IsTrue() bool

func (*Property) IsUnresolved

func (p *Property) IsUnresolved() bool

func (*Property) Metadata

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

func (*Property) MetadataWithValue

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

func (*Property) ParentRange

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

func (*Property) Range

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

func (*Property) RawValue

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

func (*Property) SetLogicalResource

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

func (*Property) Type

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

func (*Property) UnmarshalJSONWithMetadata

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

func (*Property) UnmarshalYAML

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

type PropertyInner

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

type Resource

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

func (*Resource) BoolDefault

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

func (*Resource) ConfigureResource

func (r *Resource) ConfigureResource(id string, target fs.FS, filepath string, ctx *FileContext)

func (*Resource) GetBoolProperty

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

func (*Resource) GetIntProperty

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

func (*Resource) GetProperty

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

func (*Resource) GetStringProperty

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

func (*Resource) ID

func (r *Resource) ID() string

func (*Resource) IntDefault

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

func (*Resource) IsNil

func (r *Resource) IsNil() bool

func (*Resource) Metadata

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

func (*Resource) Range

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

func (*Resource) SourceFormat

func (r *Resource) SourceFormat() SourceFormat

func (*Resource) StringDefault

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

func (*Resource) Type

func (r *Resource) Type() string

func (*Resource) UnmarshalJSONWithMetadata

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

func (*Resource) UnmarshalYAML

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

type ResourceInner

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

type SourceFormat

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

Jump to

Keyboard shortcuts

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