Documentation
¶
Index ¶
- func FindSubTraversal(t1 hcl.Traversal, t2str string) (int, error)
- func FormatTraversal(ts hcl.Traversal) string
- func FormatTraverse(t hcl.Traverser) (str string, isAttr bool)
- func IndexKeyString(key cty.Value) string
- func NewFixConfigDefinitionFunction(fixers DefinitionFixers) function.Function
- func NewFixConfigReferenceFunction(fixers ReferenceFixers) function.Function
- func ParseTraversal(t string) (hcl.Traversal, error)
- func SchemaVersioIndex(regVersions []int, version int) (int, error)
- func TraversalMatches(t1 hcl.Traversal, t2str string) (bool, error)
- func TraversalReplace(t hcl.Traversal, tpfx hcl.Traversal, nt hcl.Traversal) (hcl.Traversal, error)
- type BlockType
- type DefinitionConfigUpgrader
- type DefinitionConfigUpgraders
- type DefinitionFixers
- type FixConfigDefinitionFunction
- type FixConfigReferenceFunction
- type ReferenceConfigUpgrader
- type ReferenceConfigUpgraders
- type ReferenceFixers
- type UpgradeDefinitionConfigRequest
- type UpgradeDefinitionConfigResponse
- type UpgradeReferenceConfigRequest
- type UpgradeReferenceConfigResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindSubTraversal ¶
FindSubTraversal finds the last step's traversal index in "t1", for the sub-address "t2".
Any index/splat steps in "t1" will be ignored, except the current step in "t2" being tested is also a index/slat step.
If "t2" is not found in the "t1", -1 is returned. E.g. Given "a[0].b.c", and as "a.b", 2 is returned.
func FormatTraversal ¶
func FormatTraversal(ts hcl.Traversal) string
func FormatTraverse ¶
func IndexKeyString ¶
func NewFixConfigDefinitionFunction ¶
func NewFixConfigDefinitionFunction(fixers DefinitionFixers) function.Function
NewFixConfigDefinitionFunction returns the provider function for fixing the config definition.
func NewFixConfigReferenceFunction ¶
func NewFixConfigReferenceFunction(fixers ReferenceFixers) function.Function
NewFixConfigReferenceFunction returns the provider function for fixing the config reference.
func ParseTraversal ¶
func SchemaVersioIndex ¶
SchemaVersionIndex checks if the schema version is supported by the registered schema versions. The regVersions is supposed to be ordered from the least version. If supported, the index of the version in the regVersions is returned. Otherwise, -1 is returned.
func TraversalMatches ¶
TraversalMatches tells whether the traversal "t1" matches the sub-traversal t2.
Any index/splat steps in "t1" will be ignored, except the current step in "t2str" being tested is also a index/slat step.
current step in "t2" being tested is also a index/slat step. E.g. "a[0].b.c" matches "a.b.c", but not "a.b"
func TraversalReplace ¶
func TraversalReplace(t hcl.Traversal, tpfx hcl.Traversal, nt hcl.Traversal) (hcl.Traversal, error)
TraversalReplace finds the traveral prefix "tpfx" in the "t", replace the last traverse of "tpfx" in the "t" with the "nt".
Any index/splat steps in "t" will be ignored, except the current step in "tpfx" being tested is also a index/slat step.
If the "tpfx" is not found, "t" will be returned.
Types ¶
type DefinitionConfigUpgrader ¶
type DefinitionConfigUpgrader struct {
DefinitionConfigUpgrader func(context.Context, UpgradeDefinitionConfigRequest, *UpgradeDefinitionConfigResponse)
}
DefinitionConfigUpgrader upgrades the definition config from the current schema version to the next version
type DefinitionConfigUpgraders ¶
type DefinitionConfigUpgraders map[int]DefinitionConfigUpgrader
DefinitionConfigUpgraders is a collection of DefinitionConfigUpgrader, from the schema version 0 to the latest supported version. Each DefinitionConfigUpgraders upgrades the definition config one version forward.
The schema version expects to be continuouse within the major version of the provider.
type DefinitionFixers ¶
type DefinitionFixers map[BlockType]map[string]DefinitionConfigUpgraders
type FixConfigDefinitionFunction ¶
type FixConfigDefinitionFunction struct {
Fixers DefinitionFixers
}
func (FixConfigDefinitionFunction) Definition ¶
func (a FixConfigDefinitionFunction) Definition(_ context.Context, _ function.DefinitionRequest, response *function.DefinitionResponse)
func (FixConfigDefinitionFunction) Metadata ¶
func (a FixConfigDefinitionFunction) Metadata(_ context.Context, _ function.MetadataRequest, response *function.MetadataResponse)
func (FixConfigDefinitionFunction) Run ¶
func (a FixConfigDefinitionFunction) Run(ctx context.Context, request function.RunRequest, response *function.RunResponse)
type FixConfigReferenceFunction ¶
type FixConfigReferenceFunction struct {
Fixers ReferenceFixers
}
func (FixConfigReferenceFunction) Definition ¶
func (a FixConfigReferenceFunction) Definition(_ context.Context, _ function.DefinitionRequest, response *function.DefinitionResponse)
func (FixConfigReferenceFunction) Metadata ¶
func (a FixConfigReferenceFunction) Metadata(_ context.Context, _ function.MetadataRequest, response *function.MetadataResponse)
func (FixConfigReferenceFunction) Run ¶
func (a FixConfigReferenceFunction) Run(ctx context.Context, request function.RunRequest, response *function.RunResponse)
type ReferenceConfigUpgrader ¶
type ReferenceConfigUpgrader struct {
ReferenceConfigUpgrader func(context.Context, UpgradeReferenceConfigRequest, *UpgradeReferenceConfigResponse)
}
ReferenceConfigUpgrader upgrades the reference config from the current schema version to the next version
type ReferenceConfigUpgraders ¶
type ReferenceConfigUpgraders map[int]ReferenceConfigUpgrader
ReferenceConfigUpgraders is a collection of ReferenceConfigUpgrader, from the schema version 0 to the latest supported version. Each ReferenceConfigUpgraders upgrades the reference config one version forward.
The schema version expects to be continuouse within the major version of the provider.
type ReferenceFixers ¶
type ReferenceFixers map[BlockType]map[string]ReferenceConfigUpgraders
type UpgradeDefinitionConfigRequest ¶
type UpgradeDefinitionConfigRequest struct { // The syntax body that descirbes this definition SyntaxBody *hclsyntax.Body // The hclwrite.Body that the user is supposed to make change to WriteBody *hclwrite.Body // State can be nil for modules without state, or resource whose address contains the index State map[string]interface{} }
type UpgradeReferenceConfigRequest ¶
type UpgradeReferenceConfigRequest struct {
Traversals []hcl.Traversal
}
type UpgradeReferenceConfigResponse ¶
type UpgradeReferenceConfigResponse struct { Traversals []hcl.Traversal Error error }