parser

package
v0.86.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MIT Imports: 20 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

Types

type CFReference

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

func NewCFReference

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

func NewCFReferenceWithValue

func NewCFReferenceWithValue(resourceRange defsecTypes.Range, resolvedValue Property, logicalId string) CFReference

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() defsecTypes.Range

func (CFReference) ResourceRange

func (cf CFReference) ResourceRange() defsecTypes.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"`
	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() defsecTypes.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 added in v0.39.0

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

func (*Parser) SetSkipRequiredCheck added in v0.39.0

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 added in v0.60.0

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

func PassthroughResolution

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

func ResolveAnd added in v0.77.0

func ResolveAnd(property *Property) (resolved *Property, success 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 ResolveIf added in v0.77.0

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 ResolveNot added in v0.77.0

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

func ResolveOr added in v0.77.0

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() defsecTypes.BoolValue

func (*Property) AsInt

func (p *Property) AsInt() int

func (*Property) AsIntValue

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

func (*Property) BoolDefault

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

func (*Property) GetIntProperty

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

func (*Property) IntDefault

func (p *Property) IntDefault(defaultValue int) defsecTypes.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 added in v0.60.0

func (p *Property) IsUnresolved() bool

func (*Property) Metadata

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

func (*Property) MetadataWithValue

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

func (*Property) ParentRange

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

func (*Property) Range

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

func (*Resource) GetIntProperty

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

func (*Resource) GetProperty

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

func (*Resource) GetStringProperty

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

func (*Resource) ID

func (r *Resource) ID() string

func (*Resource) IntDefault

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

func (*Resource) IsNil

func (r *Resource) IsNil() bool

func (*Resource) Metadata

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

func (*Resource) Range

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

func (*Resource) SourceFormat

func (r *Resource) SourceFormat() SourceFormat

func (*Resource) StringDefault

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