parser

package
v0.51.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

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 WithConfigsFS

func WithConfigsFS(fsys fs.FS) options.ParserOption

func WithParameterFiles

func WithParameterFiles(files ...string) options.ParserOption

func WithParameters

func WithParameters(params map[string]any) options.ParserOption

Types

type CFReference

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

func NewCFReference

func NewCFReference(id string, resourceRange iacTypes.Range) CFReference

func (CFReference) String

func (cf CFReference) String() string

type EqualityOptions

type EqualityOptions = int
const (
	IgnoreCase EqualityOptions = iota
)

type FileContext

type FileContext struct {
	SourceFormat SourceFormat
	Ignores      ignore.Rules
	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"`
	Conditions   map[string]Property    `json:"Conditions,omitempty" yaml:"Conditions"`
	// 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() iacTypes.Metadata

func (*FileContext) OverrideParameters

func (t *FileContext) OverrideParameters(params map[string]any)

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 Parameters

type Parameters map[string]any

func (*Parameters) Merge

func (p *Parameters) Merge(other Parameters)

func (*Parameters) UnmarshalJSON

func (p *Parameters) UnmarshalJSON(data []byte) error

type Parser

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

func New

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

func (*Parser) ParseFS

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

func (*Parser) ParseFile

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

func (*Parser) Required

func (p *Parser) Required(fsys 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 ResolveAnd

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

func ResolveBase64

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

func ResolveCondition

func ResolveCondition(property *Property) (resolved *Property, success 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 ResolveIf

func ResolveIf(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 ResolveLength

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

func ResolveNot

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

func ResolveOr

func ResolveOr(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() iacTypes.BoolValue

func (*Property) AsInt

func (p *Property) AsInt() int

func (*Property) AsIntValue

func (p *Property) AsIntValue() iacTypes.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() iacTypes.StringValue

func (*Property) BoolDefault

func (p *Property) BoolDefault(defaultValue bool) iacTypes.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) iacTypes.BoolValue

func (*Property) GetIntProperty

func (p *Property) GetIntProperty(path string, defaultValue ...int) iacTypes.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) iacTypes.StringValue

func (*Property) IntDefault

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

func (*Property) Is

func (p *Property) Is(t cftypes.CfType) bool

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) Len

func (p *Property) Len() int

func (*Property) Metadata

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

func (*Property) ParentRange

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

func (*Property) Range

func (p *Property) Range() iacTypes.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) iacTypes.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) iacTypes.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) iacTypes.BoolValue

func (*Resource) GetIntProperty

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

func (*Resource) GetProperty

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

func (*Resource) GetStringProperty

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

func (*Resource) ID

func (r *Resource) ID() string

func (*Resource) IntDefault

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

func (*Resource) IsNil

func (r *Resource) IsNil() bool

func (*Resource) Metadata

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

func (*Resource) Range

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

func (*Resource) SourceFormat

func (r *Resource) SourceFormat() SourceFormat

func (*Resource) StringDefault

func (r *Resource) StringDefault(defaultValue string) iacTypes.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