modconfig

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: AGPL-3.0 Imports: 37 Imported by: 9

Documentation

Index

Constants

View Source
const (
	ConnectionTypePlugin     = "plugin"
	ConnectionTypeAggregator = "aggregator"
	ImportSchemaEnabled      = "enabled"
	ImportSchemaDisabled     = "disabled"
)
View Source
const BadIdentifierDetail = "A name must start with a letter or underscore and may contain only letters, digits, underscores, and dashes."

A consistent detail message for all "not a valid identifier" diagnostics.

Variables

View Source
var AppSpecificNewModResourcesFunc func(mod *Mod, sourceMaps ...ModResources) ModResources
View Source
var ValidImportSchemaValues = []string{ImportSchemaEnabled, ImportSchemaDisabled}

Functions

func BuildFullResourceName

func BuildFullResourceName(mod, blockType, name string) string

func BuildModDependencyPath

func BuildModDependencyPath(dependencyName string, version *DependencyVersion) string

BuildModDependencyPath converts a mod dependency name of form github.com/turbot/steampipe-mod-m2 and a DependencyVersion into a dependency path of form: - github.com/turbot/steampipe-mod-m2@v1.0.0 - github.com/turbot/steampipe-mod-m2#branch - github.com/turbot/steampipe-mod-m2:filepath This represents the relative path the dependency will be installed at underneath the mods directory

func BuildModResourceName

func BuildModResourceName(blockType, name string) string

func CheckForDuplicate added in v1.7.0

func CheckForDuplicate(existing, new HclResource) hcl.Diagnostics

check whether a resource with the same name has already been added to the mod (it is possible to add the same resource to a mod more than once as the parent resource may have dependency errors and so be decoded again)

func CustomTypeValidation added in v1.6.0

func CustomTypeValidation(ctyVal cty.Value, ctyType cty.Type, sourceRange *hcl.Range) hcl.Diagnostics

func FindRequireBlock added in v1.3.0

func FindRequireBlock(modBlock *hcl.Block) (*hcl.Block, hcl.Diagnostics)

FindRequireBlock finds the require block under the given mod block

func GetLateBindingResourceNamesFromObject added in v1.6.0

func GetLateBindingResourceNamesFromObject(val cty.Value, varShortName string) []string

GetLateBindingResourceNamesFromObject checks if the variable is late binding and if so returns the resource (connection) names which the variable depends on

func IsConnectionType added in v1.6.1

func IsConnectionType(ty cty.Type) bool

IsConnectionType returns true if the given cty.Type is a connection type

func IsCustomType added in v1.6.0

func IsCustomType(ty cty.Type) bool

IsCustomType returns true if the given cty.Type is a custom type, as determined by the customType interface

func IsLateBindingType added in v1.6.0

func IsLateBindingType(ty cty.Type) bool

IsLateBinding returns true if the type is late binding, i.e. the value is resolved at run time rather than at parse time.

func ResourceNamesFromLateBindingVarTraversal added in v1.6.0

func ResourceNamesFromLateBindingVarTraversal(traversal hcl.Traversal, evalContext *hcl.EvalContext) []string

func ResourceNamesFromLateBindingVarValue added in v1.6.0

func ResourceNamesFromLateBindingVarValue(valValue cty.Value, varShortName string) []string

ResourceNamesFromLateBindingVarValue checks if the variable value is a single or list of late binding resources (specifically - connections) and if so returns the resource names

func ResourceNamesFromLateBindingVarValueError added in v1.7.0

func ResourceNamesFromLateBindingVarValueError(e *hcl.Diagnostic, evalContext *hcl.EvalContext) []string

ResourceNamesFromLateBindingVarValueError checks if the error is due to a late binding variable (late binding variables are not added to the eval context as they are evaluated at run time)

func UnqualifiedResourceName

func UnqualifiedResourceName(fullName string) string

UnqualifiedResourceName removes the mod prefix from the given name

func ValidateValueMatchesType added in v1.6.0

func ValidateValueMatchesType(ctyVal cty.Value, ty cty.Type, sourceRange *hcl.Range) hcl.Diagnostics

Types

type AppRequire added in v1.3.2

type AppRequire struct {
	MinVersionString string `hcl:"min_version,optional"`
	Constraint       *semver.Constraints
	DeclRange        hcl.Range
}

type ConnectionImport added in v1.6.0

type ConnectionImport struct {
	HclResourceImpl
	ResourceWithMetadataImpl

	FileName        string `json:"file_name"`
	StartLineNumber int    `json:"start_line_number"`
	EndLineNumber   int    `json:"end_line_number"`

	Source      *string  `json:"source" cty:"source" hcl:"source"`
	Connections []string `json:"connections" cty:"connections" hcl:"connections,optional"`
	Prefix      *string  `json:"prefix" cty:"prefix" hcl:"prefix,optional"`
}

The definition of a single ConnectionImport

func NewConnectionImport added in v1.6.0

func NewConnectionImport(block *hcl.Block) *ConnectionImport

func (ConnectionImport) Equals added in v1.6.0

func (c ConnectionImport) Equals(other ConnectionImport) bool

func (*ConnectionImport) GetConnections added in v1.6.0

func (c *ConnectionImport) GetConnections() []string

func (*ConnectionImport) GetPrefix added in v1.6.0

func (c *ConnectionImport) GetPrefix() *string

func (*ConnectionImport) GetSource added in v1.6.0

func (c *ConnectionImport) GetSource() *string

func (*ConnectionImport) SetFileReference added in v1.6.0

func (c *ConnectionImport) SetFileReference(fileName string, startLineNumber int, endLineNumber int)

type CtyValueProvider

type CtyValueProvider interface {
	CtyValue() (cty.Value, error)
}

type DatabaseItem added in v0.3.0

type DatabaseItem interface {
	GetDatabase() *string
	GetSearchPath() []string
	GetSearchPathPrefix() []string
	SetDatabase(*string)
	SetSearchPath([]string)
	SetSearchPathPrefix([]string)
}

type DependencyVersion added in v1.3.0

type DependencyVersion struct {
	Version  *semver.Version `json:"version,omitempty"`
	Branch   string          `json:"branch,omitempty"`
	FilePath string          `json:"path,omitempty"`
	Tag      string          `json:"tag,omitempty"`
}

DependencyVersion is a struct that encapsulates the version of a mod dependency the version may be specified as a filepath, a branch or a semver version

func ParseModDependencyPath

func ParseModDependencyPath(fullName string) (string, *DependencyVersion, error)

ParseModDependencyPath converts a mod depdency path of form github.com/turbot/steampipe-mod-m2@v1.0.0 into the dependency name (github.com/turbot/steampipe-mod-m2) and version

func (DependencyVersion) Equal added in v1.3.0

func (v DependencyVersion) Equal(other *DependencyVersion) bool

func (DependencyVersion) GreaterThan added in v1.3.0

func (v DependencyVersion) GreaterThan(other *DependencyVersion) bool

func (DependencyVersion) LessThan added in v1.3.0

func (v DependencyVersion) LessThan(other *DependencyVersion) bool

func (DependencyVersion) String added in v1.6.0

func (v DependencyVersion) String() string

type DependencyVersionList added in v1.3.0

type DependencyVersionList []*DependencyVersion

func (DependencyVersionList) Len added in v1.3.0

func (c DependencyVersionList) Len() int

Len returns the length of a collection. The number of Version instances on the slice.

func (DependencyVersionList) Less added in v1.3.0

func (c DependencyVersionList) Less(i, j int) bool

Less is needed for the sort interface to compare two Version objects on the slice. If checks if one is less than the other.

func (DependencyVersionList) Swap added in v1.3.0

func (c DependencyVersionList) Swap(i, j int)

Swap is needed for the sort interface to replace the Version objects at two different positions in the slice.

type HclResource

type HclResource interface {
	printers.Showable
	printers.Listable
	Name() string
	GetTitle() string
	GetUnqualifiedName() string
	GetShortName() string
	GetFullName() string
	OnDecoded(*hcl.Block, ModResourcesProvider) hcl.Diagnostics
	GetDeclRange() *hcl.Range
	GetBlockType() string
	GetDescription() string
	GetDocumentation() string
	GetTags() map[string]string
	SetTopLevel(bool)
	IsTopLevel() bool
	GetBase() HclResource
	GetNestedStructs() []CtyValueProvider
	GetHclResourceImpl() *HclResourceImpl
}

HclResource must be implemented by resources defined in HCL

type HclResourceImpl

type HclResourceImpl struct {
	// required to allow partial decoding
	HclResourceRemain hcl.Body `hcl:",remain" json:"-"`
	// FullName is: <modShortName>.<blockType>.<shortName> if there is a mod
	// and <blockType>.<shortName> if there is no mod
	FullName  string  `cty:"name" json:"qualified_name,omitempty"`
	Title     *string `cty:"title" hcl:"title"  json:"title,omitempty"`
	ShortName string  `cty:"short_name" hcl:"name,label" json:"-"`
	// UnqualifiedName is the <blockType>.<shortName>
	UnqualifiedName string            `cty:"unqualified_name" json:"-"`
	Description     *string           `cty:"description" hcl:"description" json:"description,omitempty"`
	Documentation   *string           `cty:"documentation" hcl:"documentation" json:"documentation,omitempty"`
	DeclRange       hcl.Range         `json:"-"` // No corresponding cty tag, so using "-"
	Tags            map[string]string `cty:"tags" hcl:"tags,optional" json:"tags,omitempty"`
	// TODO can we move this out of here?
	MaxConcurrency *int `cty:"max_concurrency" hcl:"max_concurrency,optional" json:"max_concurrency,omitempty"`

	BlockType string `json:"-"`
	// contains filtered or unexported fields
}

func NewHclResourceImpl

func NewHclResourceImpl(block *hcl.Block, fullName string, opts ...HclResourceImplOption) HclResourceImpl

func (*HclResourceImpl) CtyValue

func (h *HclResourceImpl) CtyValue() (cty.Value, error)

CtyValue implements CtyValueProvider

func (*HclResourceImpl) Equals

func (h *HclResourceImpl) Equals(other *HclResourceImpl) bool

func (*HclResourceImpl) GetBase

func (h *HclResourceImpl) GetBase() HclResource

GetBase implements HclResource

func (*HclResourceImpl) GetBlockType added in v1.7.0

func (h *HclResourceImpl) GetBlockType() string

GetBlockType implements HclResource

func (*HclResourceImpl) GetDeclRange

func (h *HclResourceImpl) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*HclResourceImpl) GetDescription

func (h *HclResourceImpl) GetDescription() string

GetDescription implements HclResource

func (*HclResourceImpl) GetDocumentation

func (h *HclResourceImpl) GetDocumentation() string

GetDocumentation implements HclResource

func (*HclResourceImpl) GetFullName added in v1.7.0

func (h *HclResourceImpl) GetFullName() string

GetFullName implements *Mod

func (*HclResourceImpl) GetHclResourceImpl

func (h *HclResourceImpl) GetHclResourceImpl() *HclResourceImpl

GetHclResourceImpl implements HclResource

func (*HclResourceImpl) GetListData added in v0.3.0

func (h *HclResourceImpl) GetListData() *printers.RowData

GetListData implements printers.Showable

func (*HclResourceImpl) GetNestedStructs added in v1.7.0

func (h *HclResourceImpl) GetNestedStructs() []CtyValueProvider

func (*HclResourceImpl) GetShortName added in v0.3.0

func (h *HclResourceImpl) GetShortName() string

GetShortName implements HclResource

func (*HclResourceImpl) GetShowData added in v0.3.0

func (h *HclResourceImpl) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*HclResourceImpl) GetTags

func (h *HclResourceImpl) GetTags() map[string]string

GetTags implements HclResource

func (*HclResourceImpl) GetTitle

func (h *HclResourceImpl) GetTitle() string

GetTitle implements HclResource

func (*HclResourceImpl) GetUnqualifiedName

func (h *HclResourceImpl) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*HclResourceImpl) IsTopLevel

func (h *HclResourceImpl) IsTopLevel() bool

IsTopLevel implements HclResource

func (*HclResourceImpl) Name

func (h *HclResourceImpl) Name() string

Name implements HclResource return name in format: '<blocktype>.<shortName>'

func (*HclResourceImpl) OnDecoded

func (h *HclResourceImpl) OnDecoded(block *hcl.Block, _ ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*HclResourceImpl) SetBase added in v1.7.0

func (h *HclResourceImpl) SetBase(base HclResource)

func (*HclResourceImpl) SetBaseProperties added in v1.7.0

func (h *HclResourceImpl) SetBaseProperties()

func (*HclResourceImpl) SetTopLevel

func (h *HclResourceImpl) SetTopLevel(isTopLevel bool)

SetTopLevel implements HclResource

type HclResourceImplOption added in v1.7.0

type HclResourceImplOption func(*HclResourceImpl)

options pattern

func WithDisableCtySerialise added in v1.7.0

func WithDisableCtySerialise() HclResourceImplOption

type Local

type Local struct {
	ModTreeItemImpl

	// required to allow partial decoding
	Remain hcl.Body `hcl:",remain" json:"-"`

	Value cty.Value
}

Local is a struct representing a Local resource

func NewLocal

func NewLocal(name string, val cty.Value, declRange hcl.Range, mod *Mod) *Local

func (*Local) CtyValue

func (l *Local) CtyValue() (cty.Value, error)

CtyValue implements CtyValueProvider

func (*Local) Diff

func (l *Local) Diff(other *Local) *ModTreeItemDiffs

type MissingVariableError

type MissingVariableError struct {
	MissingVariables []*Variable
}

func (MissingVariableError) Error

func (m MissingVariableError) Error() string

type Mod

type Mod struct {
	ResourceWithMetadataImpl
	ModTreeItemImpl

	// required to allow partial decoding
	Remain hcl.Body `hcl:",remain" json:"-"`

	// attributes
	Categories []string `cty:"categories" hcl:"categories,optional" json:"categories,omitempty"`
	Color      *string  `cty:"color" hcl:"color" json:"color,omitempty"`
	Icon       *string  `cty:"icon" hcl:"icon" json:"icon,omitempty"`

	// blocks
	Require       *Require   `hcl:"require,block"  json:"-"`
	LegacyRequire *Require   `hcl:"requires,block"  json:"-"`
	OpenGraph     *OpenGraph `hcl:"opengraph,block" json:"open_graph,omitempty"`

	// the mod version
	Version *DependencyVersion `json:"-"`
	// DependencyPath is the fully qualified mod name including version,
	// which will by the map key in the workspace lock file
	// NOTE: this is the relative path to the mod location from the dependency install dir (.steampipe/mods)
	// e.g. github.com/turbot/steampipe-mod-azure-thrifty@v1.0.0
	// It is populated for dependency mods as part of the mod loading process
	// NOTE: if this mod dependency is a local file dependency, the dependency path will be the file path
	DependencyPath *string `json:"dependency_path,omitempty"`
	// DependencyName return the name of the mod as a dependency, i.e. the mod dependency path, _without_ the version
	// e.g. github.com/turbot/steampipe-mod-azure-thrifty
	DependencyName string `json:"-"`

	// ModPath is the installation location of the mod
	ModPath string `json:"-"`

	// convenient aggregation of all resources
	Resources ModResources `json:"-"`
	// contains filtered or unexported fields
}

Mod is a struct representing a Mod resource

func CreateDefaultMod

func CreateDefaultMod(modPath string) *Mod

CreateDefaultMod creates a default mod created for a workspace with no mod definition

func NewMod

func NewMod(shortName, modPath string, defRange hcl.Range) *Mod

func (*Mod) AddModDependencies

func (m *Mod) AddModDependencies(modVersions map[string]*ModVersionConstraint)

func (*Mod) AddReference

func (m *Mod) AddReference(ref *ResourceReference)

AddReference implements ResourceWithMetadata (overridden from ResourceWithMetadataImpl)

func (*Mod) AddResource

func (m *Mod) AddResource(item HclResource) hcl.Diagnostics

func (*Mod) BuildResourceTree

func (m *Mod) BuildResourceTree(loadedDependencyMods ModMap) (err error)

BuildResourceTree builds the control tree structure by setting the parent property for each control and benchmark NOTE: this also builds the sorted benchmark list

func (*Mod) CacheKey added in v1.6.0

func (m *Mod) CacheKey() string

func (*Mod) CtyValue

func (m *Mod) CtyValue() (cty.Value, error)

CtyValue implements CtyValueProvider

func (*Mod) Equals

func (m *Mod) Equals(other *Mod) bool

func (*Mod) FilePath added in v0.3.0

func (m *Mod) FilePath() string

func (*Mod) GetConnectionDependsOn added in v1.6.0

func (m *Mod) GetConnectionDependsOn() []string

func (*Mod) GetDefaultConnectionString added in v1.6.0

func (m *Mod) GetDefaultConnectionString(evalContext *hcl.EvalContext) (string, error)

func (*Mod) GetFilePath added in v1.7.0

func (m *Mod) GetFilePath() string

func (*Mod) GetInstallCacheKey

func (m *Mod) GetInstallCacheKey() string

GetInstallCacheKey returns the key used to find this mod in a workspace lock InstallCache

func (*Mod) GetModDependency

func (m *Mod) GetModDependency(modName string) *ModVersionConstraint

func (*Mod) GetModResources added in v1.7.0

func (m *Mod) GetModResources() ModResources

GetModResources implements ModResourcesProvider

func (*Mod) GetPaths

func (m *Mod) GetPaths() []NodePath

GetPaths implements ModTreeItem (override base functionality)

func (*Mod) GetReferences

func (m *Mod) GetReferences() []*ResourceReference

GetReferences implements ResourceWithMetadata (overridden from ResourceWithMetadataImpl)

func (*Mod) GetResource

func (m *Mod) GetResource(parsedName *ParsedResourceName) (resource HclResource, found bool)

func (*Mod) HasDependentMods

func (m *Mod) HasDependentMods() bool

func (*Mod) IsDefaultMod

func (m *Mod) IsDefaultMod() bool

IsDefaultMod returns whether this mod is a default mod created for a workspace with no mod definition

func (*Mod) OnDecoded

func (m *Mod) OnDecoded(block *hcl.Block, _ ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*Mod) RemoveAllModDependencies

func (m *Mod) RemoveAllModDependencies()

func (*Mod) RemoveModDependencies

func (m *Mod) RemoveModDependencies(modVersions map[string]*ModVersionConstraint)

func (*Mod) RequireHasUnresolvedArgs

func (m *Mod) RequireHasUnresolvedArgs() bool

RequireHasUnresolvedArgs returns whether the mod has any mod requirements which have unresolved args (this could be because the arg refers to a variable, meanin gwe need an additional parse phase to resolve the arg values)

func (*Mod) Save

func (m *Mod) Save() error

func (*Mod) SetDependencyConfig

func (m *Mod) SetDependencyConfig(dependencyVersion *DependencyVersion, dependencyPath *string, dependencyName string)

func (*Mod) SetDependencyConfigFromPath added in v1.7.0

func (m *Mod) SetDependencyConfigFromPath(dependencyPath string) error

SetDependencyConfigFromPath sets DependencyPath, DependencyName and Version

func (*Mod) SetFilePath

func (m *Mod) SetFilePath(modFilePath string)

func (*Mod) SetModResources added in v1.7.0

func (m *Mod) SetModResources(modResources ModResources)

func (*Mod) SetPaths

func (m *Mod) SetPaths()

SetPaths implements ModTreeItem (override base functionality)

func (*Mod) ValidateRequirements

func (m *Mod) ValidateRequirements(pluginVersionMap *plugin.PluginVersionMap) []error

ValidateRequirements validates that the current steampipe CLI and the installed plugins is compatible with the mod

func (*Mod) WalkResources

func (m *Mod) WalkResources(resourceFunc func(item HclResource) (bool, error)) error

type ModItem

type ModItem interface {
	GetMod() *Mod
}

type ModMap

type ModMap map[string]*Mod

ModMap is a map of mod name to mod

type ModResources added in v1.7.0

type ModResources interface {
	WalkResources(resourceFunc func(item HclResource) (bool, error)) error
	AddResource(item HclResource) hcl.Diagnostics
	GetResource(parsedName *ParsedResourceName) (resource HclResource, found bool)
	Equals(other ModResources) bool
	AddReference(ref *ResourceReference)
	GetReferences() map[string]*ResourceReference
	GetVariables() map[string]*Variable
	GetMods() map[string]*Mod
	TopLevelResources() ModResources
	AddMaps(i ...ModResources)
}

func NewModResources

func NewModResources(mod *Mod, sourceMaps ...ModResources) ModResources

type ModResourcesProvider added in v1.7.0

type ModResourcesProvider interface {
	GetModResources() ModResources
	GetResource(parsedName *ParsedResourceName) (resource HclResource, found bool)
}

type ModTreeItem

type ModTreeItem interface {
	HclResource
	DatabaseItem

	AddParent(ModTreeItem) error
	GetParents() []ModTreeItem
	GetChildren() []ModTreeItem
	// GetPaths returns an array resource paths
	GetPaths() []NodePath
	SetPaths()
	GetModTreeItemImpl() *ModTreeItemImpl
	IsDependencyResource() bool
}

ModTreeItem must be implemented by elements of the mod resource hierarchy i.e. Control, Benchmark, Dashboard

type ModTreeItemDiffs added in v1.7.0

type ModTreeItemDiffs struct {
	Name              string
	Item              ModTreeItem
	ChangedProperties []string
	AddedItems        []string
	RemovedItems      []string
}

ModTreeItemDiffs is a struct representing the differences between 2 DashboardTreeItems (of same type)

func (*ModTreeItemDiffs) AddAddedItem added in v1.7.0

func (d *ModTreeItemDiffs) AddAddedItem(name string)

func (*ModTreeItemDiffs) AddPropertyDiff added in v1.7.0

func (d *ModTreeItemDiffs) AddPropertyDiff(propertyName string)

func (*ModTreeItemDiffs) AddRemovedItem added in v1.7.0

func (d *ModTreeItemDiffs) AddRemovedItem(name string)

func (*ModTreeItemDiffs) HasChanges added in v1.7.0

func (d *ModTreeItemDiffs) HasChanges() bool

func (*ModTreeItemDiffs) Merge added in v1.7.0

func (d *ModTreeItemDiffs) Merge(other *ModTreeItemDiffs)

func (*ModTreeItemDiffs) PopulateChildDiffs added in v1.7.0

func (d *ModTreeItemDiffs) PopulateChildDiffs(old ModTreeItem, new ModTreeItem)

type ModTreeItemImpl

type ModTreeItemImpl struct {
	HclResourceImpl
	// required to allow partial decoding
	ModTreeItemRemain hcl.Body `hcl:",remain" json:"-"`

	// auto cty serialisation fails with an NRE for mod struct so we manually serialise
	Mod              *Mod     `cty:"-" json:"-"`
	Database         *string  `cty:"database" hcl:"database" json:"database,omitempty"`
	SearchPath       []string `cty:"search_path" hcl:"search_path,optional" json:"search_path,omitempty"`
	SearchPathPrefix []string `cty:"search_path_prefix" hcl:"search_path_prefix,optional" json:"search_path_prefix,omitempty"`

	Paths    []NodePath    `json:"path,omitempty"`
	Children []ModTreeItem `json:"-"`
	// contains filtered or unexported fields
}

func NewModTreeItemImpl

func NewModTreeItemImpl(block *hcl.Block, mod *Mod, shortName string) ModTreeItemImpl

func (*ModTreeItemImpl) AddChild added in v1.7.0

func (b *ModTreeItemImpl) AddChild(children ...ModTreeItem)

func (*ModTreeItemImpl) AddParent

func (b *ModTreeItemImpl) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*ModTreeItemImpl) CtyValue

func (b *ModTreeItemImpl) CtyValue() (cty.Value, error)

CtyValue implements CtyValueProvider

func (*ModTreeItemImpl) GetChildren

func (b *ModTreeItemImpl) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*ModTreeItemImpl) GetDatabase added in v0.3.0

func (b *ModTreeItemImpl) GetDatabase() *string

GetDatabase implements DatabaseItem

func (*ModTreeItemImpl) GetListData added in v0.3.0

func (b *ModTreeItemImpl) GetListData() *printers.RowData

GetListData implements printers.Listable

func (*ModTreeItemImpl) GetMod

func (b *ModTreeItemImpl) GetMod() *Mod

GetMod implements ModItem, ModTreeItem

func (*ModTreeItemImpl) GetModTreeItemImpl

func (b *ModTreeItemImpl) GetModTreeItemImpl() *ModTreeItemImpl

GetModTreeItemImpl implements ModTreeItem

func (*ModTreeItemImpl) GetNestedStructs added in v1.7.0

func (b *ModTreeItemImpl) GetNestedStructs() []CtyValueProvider

func (*ModTreeItemImpl) GetParents

func (b *ModTreeItemImpl) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*ModTreeItemImpl) GetPaths

func (b *ModTreeItemImpl) GetPaths() []NodePath

func (*ModTreeItemImpl) GetSearchPath added in v0.3.0

func (b *ModTreeItemImpl) GetSearchPath() []string

GetSearchPath implements DatabaseItem

func (*ModTreeItemImpl) GetSearchPathPrefix added in v0.3.0

func (b *ModTreeItemImpl) GetSearchPathPrefix() []string

GetSearchPathPrefix implements DatabaseItem

func (*ModTreeItemImpl) GetShowData added in v0.3.0

func (b *ModTreeItemImpl) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*ModTreeItemImpl) IsDependencyResource added in v0.3.0

func (b *ModTreeItemImpl) IsDependencyResource() bool

func (*ModTreeItemImpl) SetChildren added in v1.7.0

func (b *ModTreeItemImpl) SetChildren(children []ModTreeItem)

func (*ModTreeItemImpl) SetDatabase added in v1.6.0

func (b *ModTreeItemImpl) SetDatabase(database *string)

SetDatabase implements DatabaseItem

func (*ModTreeItemImpl) SetPaths

func (b *ModTreeItemImpl) SetPaths()

SetPaths implements ModTreeItem

func (*ModTreeItemImpl) SetSearchPath added in v1.6.0

func (b *ModTreeItemImpl) SetSearchPath(searchPath []string)

SetSearchPath implements DatabaseItem

func (*ModTreeItemImpl) SetSearchPathPrefix added in v1.6.0

func (b *ModTreeItemImpl) SetSearchPathPrefix(searchPathPrefix []string)

SetSearchPathPrefix implements DatabaseItem

type ModVariableMap

type ModVariableMap struct {
	// which mod have these variables been loaded for?
	Mod *Mod
	// top level variables, keyed by short name
	RootVariables map[string]*Variable
	// map of dependency variable maps, keyed by dependency NAME
	DependencyVariables map[string]*ModVariableMap

	// a list of the pointers to the variables whose values can be changed
	// NOTE: this refers to the SAME variable objects as exist in the RootVariables and DependencyVariables maps,
	// so when we set the value of public variables, we mutate the underlying variable
	PublicVariables map[string]*Variable
}

ModVariableMap is a struct containing maps of variable definitions

func NewModVariableMap

func NewModVariableMap(mod *Mod) (*ModVariableMap, error)

NewModVariableMap builds a ModVariableMap using the variables from a mod and its dependencies

func (*ModVariableMap) GetPublicVariableValues

func (m *ModVariableMap) GetPublicVariableValues() (map[string]string, error)

GetPublicVariableValues converts public variables into a map of string variable values

func (*ModVariableMap) PopulatePublicVariables

func (m *ModVariableMap) PopulatePublicVariables()

PopulatePublicVariables builds a map of top level and dependency variables (dependency variables are keyed by full (qualified) name

func (*ModVariableMap) ToArray

func (m *ModVariableMap) ToArray() []*Variable

type ModVersionConstraint

type ModVersionConstraint struct {
	// the fully qualified mod name, e.g. github.com/turbot/mod1
	Name string `cty:"name" hcl:"name,label"`
	// variable values to be set on the dependency mod
	Args map[string]cty.Value `cty:"args"  hcl:"args,optional"`

	// optionally override the database and search path
	Database         *string  `cty:"database" hcl:"database"`
	SearchPath       []string `cty:"search_path" hcl:"search_path,optional"`
	SearchPathPrefix []string `cty:"search_path_prefix" hcl:"search_path_prefix,optional"`
	// the version constraint string
	VersionString string `cty:"version" hcl:"version,optional"`
	// the local file location to use
	FilePath string `cty:"path" hcl:"path,optional"`
	// the branch name to use
	BranchName string `cty:"branch" hcl:"branch,optional"`
	// the (non-version) tag to use
	// populated only if a tag which is not a semver is used
	Tag string `cty:"tag" hcl:"tag,optional"`

	// contains the range of the definition of the mod block
	DefRange hcl.Range
	// contains the range of the body of the mod block
	BodyRange hcl.Range
	// contains the range of the version/branch/tag/path field
	VersionRange hcl.Range
	// contains filtered or unexported fields
}

ModVersionConstraint is a struct to represent a version as specified in a mod require block

func NewFilepathModVersionConstraint added in v1.3.0

func NewFilepathModVersionConstraint(mod *Mod) *ModVersionConstraint

func NewModVersionConstraint

func NewModVersionConstraint(modFullName string) (*ModVersionConstraint, error)

NewModVersionConstraint creates a new ModVersionConstraint - this is called when installing a mod

func (*ModVersionConstraint) DependencyPath

func (m *ModVersionConstraint) DependencyPath() string

func (*ModVersionConstraint) Equals

func (*ModVersionConstraint) HasVersion

func (m *ModVersionConstraint) HasVersion() bool

HasVersion returns whether the mod has a version specified, or is the latest if no version is specified, or the version is "latest", this is the latest version

func (*ModVersionConstraint) Initialise

func (m *ModVersionConstraint) Initialise(block *hcl.Block) hcl.Diagnostics

Initialise parses the version and name properties

func (*ModVersionConstraint) IsPrerelease added in v1.3.0

func (m *ModVersionConstraint) IsPrerelease() bool

func (*ModVersionConstraint) OriginalConstraint added in v1.3.0

func (m *ModVersionConstraint) OriginalConstraint() any

func (*ModVersionConstraint) String

func (m *ModVersionConstraint) String() string

func (*ModVersionConstraint) VersionConstraint added in v1.3.0

func (m *ModVersionConstraint) VersionConstraint() *versionhelpers.Constraints

type ModVersionConstraintCollection

type ModVersionConstraintCollection []*ModVersionConstraint

ModVersionConstraintCollection is a collection of ModVersionConstraint instances and implements the sort interface. See the sort package for more details. https://golang.org/pkg/sort/

func (ModVersionConstraintCollection) Len

Len returns the length of a collection. The number of Version instances on the slice.

func (ModVersionConstraintCollection) Less

Less is needed for the sort interface to compare two Version objects on the slice. If checks if one is less than the other.

func (ModVersionConstraintCollection) Swap

func (c ModVersionConstraintCollection) Swap(i, j int)

Swap is needed for the sort interface to replace the Version objects at two different positions in the slice.

type NamedItem

type NamedItem struct {
	Name string `cty:"name"`
}

NamedItem is a struct used by benchmark, container and dashboard to specify children of different types

func (NamedItem) String

func (c NamedItem) String() string

type NamedItemList

type NamedItemList []NamedItem

func (NamedItemList) StringList

func (l NamedItemList) StringList() []string

type NodePath

type NodePath []string

NodePath is a string array representing the parentage of a ModTreeItem

type OpenGraph

type OpenGraph struct {
	// The opengraph description (og:description) of the mod, for use in social media applications
	Description *string `cty:"description" hcl:"description" json:"description"`
	// The opengraph display title (og:title) of the mod, for use in social media applications.
	Title     *string   `cty:"title" hcl:"title" json:"title"`
	Image     *string   `cty:"image" hcl:"image" json:"image"`
	DeclRange hcl.Range `json:"-"`
}

OpenGraph is a struct representing the OpenGraph group mod resource

type OptionsBlockFactory

type OptionsBlockFactory = func(*hcl.Block) (options.Options, hcl.Diagnostics)

type ParamDef

type ParamDef struct {
	ShortName       string  `cty:"name" json:"name"`
	UnqualifiedName string  `cty:"full_name" json:"-"`
	Description     *string `cty:"description" json:"description"`
	Default         *string `cty:"default" json:"default"`
	// tactical - is the raw value a string
	IsString bool `cty:"is_string" json:"-"`

	// list of all blocks referenced by the resource
	References []*ResourceReference `json:"-"`
	DeclRange  hcl.Range            `json:"-"`
}

func NewParamDef

func NewParamDef(block *hcl.Block) *ParamDef

func (*ParamDef) Equals

func (p *ParamDef) Equals(other *ParamDef) bool

func (*ParamDef) GetDefault

func (p *ParamDef) GetDefault() (any, error)

GetDefault returns the default as an interface{}, unmarshalling json is the underlying value was NOT a string

func (*ParamDef) GetShowData added in v0.3.0

func (p *ParamDef) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*ParamDef) SetDefault

func (p *ParamDef) SetDefault(value interface{}) error

SetDefault sets the default as a string points, marshalling to json is the underlying value is NOT a string

func (*ParamDef) String

func (p *ParamDef) String() string

type ParsedPropertyPath

type ParsedPropertyPath struct {
	Mod          string
	ItemType     string
	Name         string
	PropertyPath []string
	// optional scope of this property path ("self")
	Scope    string
	Original string
}

func ParseResourcePropertyPath

func ParseResourcePropertyPath(propertyPath string) (*ParsedPropertyPath, error)

func PropertyPathFromExpression

func PropertyPathFromExpression(expr hcl.Expression) (bool, *ParsedPropertyPath, error)

func (*ParsedPropertyPath) PropertyPathString

func (p *ParsedPropertyPath) PropertyPathString() string

func (*ParsedPropertyPath) String

func (p *ParsedPropertyPath) String() string

func (*ParsedPropertyPath) ToParsedResourceName

func (p *ParsedPropertyPath) ToParsedResourceName() *ParsedResourceName

func (*ParsedPropertyPath) ToResourceName

func (p *ParsedPropertyPath) ToResourceName() string

type ParsedResourceName

type ParsedResourceName struct {
	Mod      string
	ItemType string
	Name     string
}

func ParseResourceName

func ParseResourceName(fullName string) (res *ParsedResourceName, err error)

func (*ParsedResourceName) ToFullName

func (p *ParsedResourceName) ToFullName() string

func (*ParsedResourceName) ToFullNameWithMod

func (p *ParsedResourceName) ToFullNameWithMod(mod string) string

func (*ParsedResourceName) ToResourceName

func (p *ParsedResourceName) ToResourceName() string

type RawVariable added in v1.6.0

type RawVariable struct {
	Name           string
	Title          string
	Description    string
	Default        cty.Value
	Type           cty.Type
	TypeString     string
	ParsingMode    VariableParsingMode
	Enum           cty.Value
	EnumGo         []any
	DescriptionSet bool
	Format         string
	DeclRange      hcl.Range
}

RawVariable represents a "variable" block in a module or file.

func (*RawVariable) Required added in v1.6.0

func (v *RawVariable) Required() bool

Required returns true if this variable is required to be set by the caller, or false if there is a default value that will be used when it isn't set.

type Require

type Require struct {
	Plugins                          []*plugin.PluginVersion `hcl:"plugin,block"`
	DeprecatedSteampipeVersionString string                  `hcl:"steampipe,optional"`

	// one of these may be set
	Flowpipe  *AppRequire `hcl:"flowpipe,block"`
	Steampipe *AppRequire `hcl:"steampipe,block"`
	Powerpipe *AppRequire `hcl:"powerpipe,block"`

	Mods []*ModVersionConstraint `hcl:"mod,block"`
	// map keyed by name [and alias]
	ModMap map[string]*ModVersionConstraint
	// range of the require block body
	DeclRange hcl.Range
	// range of the require block type
	TypeRange hcl.Range
	// contains filtered or unexported fields
}

Require is a struct representing mod dependencies

func NewRequire

func NewRequire() *Require

func (*Require) AddModDependencies

func (r *Require) AddModDependencies(newModVersions map[string]*ModVersionConstraint)

AddModDependencies adds all the mod in newModVersions to our list of mods, using the following logic - if a mod with same name, [alias] and constraint exists, it is not added - if a mod with same name [and alias] and different constraint exist, it is replaced

func (*Require) AppVersionConstraint added in v1.3.2

func (r *Require) AppVersionConstraint() *semver.Constraints

func (*Require) Clone

func (r *Require) Clone() *Require

func (*Require) ContainsMod

func (r *Require) ContainsMod(requiredModVersion *ModVersionConstraint) bool

func (*Require) Empty

func (r *Require) Empty() bool

func (*Require) GetModDependency

func (r *Require) GetModDependency(name string) *ModVersionConstraint

func (*Require) InitialiseConstraints added in v1.3.0

func (r *Require) InitialiseConstraints(requireBlock *hcl.Block) hcl.Diagnostics

func (*Require) RemoveAllModDependencies

func (r *Require) RemoveAllModDependencies()

func (*Require) RemoveModDependencies

func (r *Require) RemoveModDependencies(versions map[string]*ModVersionConstraint)

type ResourceDependency

type ResourceDependency struct {
	Range      hcl.Range
	Traversals []hcl.Traversal
}

func (*ResourceDependency) IsRuntimeDependency

func (d *ResourceDependency) IsRuntimeDependency() bool

func (*ResourceDependency) String

func (d *ResourceDependency) String() string

type ResourceMetadata

type ResourceMetadata struct {
	// required to allow partial decoding
	ResourceMetadataRemain hcl.Body `hcl:",remain" json:"-"`

	ResourceName string `json:"resource_name"`
	// mod short name
	ModName          string `json:"mod_name"`
	FileName         string `json:"file_name"`
	StartLineNumber  int    `json:"start_line_number"`
	EndLineNumber    int    `json:"end_line_number"`
	IsAutoGenerated  bool   `json:"auto_generated"`
	SourceDefinition string `json:"source_definition"`
	Anonymous        bool   `json:"is_anonymous"`
	ModFullName      string `json:"-"`
}

ResourceMetadata is a struct containing additional data about each resource, used to populate the introspection tables

func (*ResourceMetadata) Clone

func (*ResourceMetadata) SetMod

func (m *ResourceMetadata) SetMod(mod *Mod)

SetMod sets the mod name and mod short name

type ResourceProvider added in v1.6.0

type ResourceProvider interface {
	GetResource(parsedName *ParsedResourceName) (resource HclResource, found bool)
}

type ResourceReference

type ResourceReference struct {
	ResourceWithMetadataImpl

	To        string `cty:"reference_to" json:"reference_to,omitempty"`
	From      string `cty:"reference_from" json:"reference_from,omitempty"`
	BlockType string `cty:"from_block_type" json:"from_block_type,omitempty"`
	BlockName string `cty:"from_block_name" json:"from_block_name,omitempty"`
	Attribute string `cty:"from_attribute" json:"from_attribute,omitempty"`
	// contains filtered or unexported fields
}

func NewResourceReference

func NewResourceReference(resource HclResource, block *hcl.Block, referenceString string, blockName string, attr *hclsyntax.Attribute) *ResourceReference

func (*ResourceReference) CloneWithNewFrom

func (r *ResourceReference) CloneWithNewFrom(from string) *ResourceReference

func (*ResourceReference) Equals

func (r *ResourceReference) Equals(other *ResourceReference) bool

func (*ResourceReference) GetShowData added in v0.3.0

func (r *ResourceReference) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*ResourceReference) Name

func (r *ResourceReference) Name() string

Name implements ResourceWithMetadata the name must start with the 'resource type' as we parse it and use just the 'name' segment

func (*ResourceReference) String

func (r *ResourceReference) String() string

type ResourceReferenceMap

type ResourceReferenceMap map[string][]*ResourceReference

ResourceReferenceMap is a map of references keyed by 'ref' This is to handle the same reference being made more than once by a resource for example the reference var.v1 might be referenced several times

func (ResourceReferenceMap) Add

func (m ResourceReferenceMap) Add(reference *ResourceReference)

type ResourceWithMetadata

type ResourceWithMetadata interface {
	Name() string
	GetMetadata() *ResourceMetadata
	SetMetadata(metadata *ResourceMetadata)
	SetAnonymous(block *hcl.Block)
	IsAnonymous() bool
	AddReference(ref *ResourceReference)
	GetReferences() []*ResourceReference
	GetResourceWithMetadataRemain() hcl.Body
}

ResourceWithMetadata must be implemented by resources which supports reflection metadata

type ResourceWithMetadataImpl

type ResourceWithMetadataImpl struct {
	ResourceMetadata
	// required to allow partial decoding
	ResourceWithMetadataImplRemain hcl.Body             `hcl:",remain" json:"-"`
	References                     []*ResourceReference `json:"references,omitempty"`
	// contains filtered or unexported fields
}

func (*ResourceWithMetadataImpl) AddReference

func (b *ResourceWithMetadataImpl) AddReference(ref *ResourceReference)

AddReference implements ResourceWithMetadata

func (*ResourceWithMetadataImpl) GetMetadata

func (b *ResourceWithMetadataImpl) GetMetadata() *ResourceMetadata

GetMetadata implements ResourceWithMetadata

func (*ResourceWithMetadataImpl) GetReferences

func (b *ResourceWithMetadataImpl) GetReferences() []*ResourceReference

GetReferences implements ResourceWithMetadata

func (*ResourceWithMetadataImpl) GetResourceWithMetadataRemain added in v1.7.0

func (b *ResourceWithMetadataImpl) GetResourceWithMetadataRemain() hcl.Body

GetRemain implements ResourceWithMetadata

func (*ResourceWithMetadataImpl) IsAnonymous

func (b *ResourceWithMetadataImpl) IsAnonymous() bool

IsAnonymous implements ResourceWithMetadata

func (*ResourceWithMetadataImpl) SetAnonymous

func (b *ResourceWithMetadataImpl) SetAnonymous(block *hcl.Block)

SetAnonymous implements ResourceWithMetadata

func (*ResourceWithMetadataImpl) SetMetadata

func (b *ResourceWithMetadataImpl) SetMetadata(metadata *ResourceMetadata)

SetMetadata implements ResourceWithMetadata

type SteampipeConnection added in v1.6.0

type SteampipeConnection struct {
	// connection name
	Name string `json:"name"`
	// name of plugin as mentioned in config - this may be an alias to a plugin image ref
	// OR the label of a plugin config
	PluginAlias string `json:"plugin_short_name"`
	// image ref plugin.
	// we resolve this after loading all plugin configs
	Plugin string `json:"plugin"`
	// the label of the plugin config we are using
	PluginInstance *string `json:"plugin_instance"`
	// Path to the installed plugin (if it exists)
	PluginPath *string
	// connection type - supported values: "aggregator"
	Type string `json:"type,omitempty"`
	// should a schema be created for this connection - supported values: "enabled", "disabled"
	ImportSchema string `json:"import_schema"`
	// list of names or wildcards which are resolved to connections
	// (only valid for "aggregator" type)
	ConnectionNames []string `json:"connections,omitempty"`
	// a map of the resolved child connections
	// (only valid for "aggregator" type)
	Connections map[string]*SteampipeConnection `json:"-"`
	// a list of the names resolved child connections
	// (only valid for "aggregator" type)
	ResolvedConnectionNames []string `json:"resolved_connections,omitempty"`
	// unparsed HCL of plugin specific connection config
	Config string `json:"config,omitempty"`

	Error error

	DeclRange hclhelpers.Range `json:"decl_range"`
}

SteampipeConnection is a struct representing the partially parsed connection

(Partial as the connection config, which is plugin specific, is stored as raw HCL. This will be parsed by the plugin) json tags needed as this is stored in the connection state file

func NewConnection

func NewConnection(block *hcl.Block) *SteampipeConnection

func (*SteampipeConnection) Equals added in v1.6.0

func (c *SteampipeConnection) Equals(other *SteampipeConnection) bool

func (*SteampipeConnection) GetDeclRange added in v1.6.0

func (c *SteampipeConnection) GetDeclRange() hclhelpers.Range

func (*SteampipeConnection) GetDisplayName added in v1.6.0

func (c *SteampipeConnection) GetDisplayName() string

func (*SteampipeConnection) GetEmptyAggregatorError added in v1.6.0

func (c *SteampipeConnection) GetEmptyAggregatorError() string

func (*SteampipeConnection) GetName added in v1.6.0

func (c *SteampipeConnection) GetName() string

func (*SteampipeConnection) GetResolveConnectionNames added in v1.6.0

func (c *SteampipeConnection) GetResolveConnectionNames() []string

GetResolveConnectionNames return the names of all child connections (will only be non-empty for aggregator connections)

func (*SteampipeConnection) ImportDisabled added in v1.6.0

func (c *SteampipeConnection) ImportDisabled() bool

func (*SteampipeConnection) PopulateChildren added in v1.6.0

func (c *SteampipeConnection) PopulateChildren(connectionMap map[string]*SteampipeConnection) []string

func (*SteampipeConnection) String added in v1.6.0

func (c *SteampipeConnection) String() string

func (*SteampipeConnection) Validate added in v1.6.0

func (c *SteampipeConnection) Validate(map[string]*SteampipeConnection) (warnings []string, errors []string)

Validate verifies the Type property is valid, if this is an aggregator connection, there must be at least one child, and no duplicates if this is NOT an aggregator, there must be no children

func (*SteampipeConnection) ValidateAggregatorConnection added in v1.6.0

func (c *SteampipeConnection) ValidateAggregatorConnection() (warnings, errors []string)

type Variable

type Variable struct {
	ResourceWithMetadataImpl
	ModTreeItemImpl

	// required to allow partial decoding
	Remain hcl.Body `hcl:",remain" json:"-"`

	Default cty.Value         ` json:"-"`
	Type    cty.Type          ` json:"-"`
	Tags    map[string]string `cty:"tags" hcl:"tags,optional" json:"tags,omitempty"`
	Enum    cty.Value         `json:"-"`

	// TypeString shows the type as specified in the hcl file
	// or if no type is specified, it derives a type string from the variable value
	TypeString    string         `json:"type_string"`
	DefaultGo     any            `json:"value_default"`
	ValueGo       any            `json:"value"`
	EnumGo        []any          `json:"enum,omitempty"`
	ModName       string         `json:"mod_name"`
	Subtype       hcl.Expression `json:"-"`
	SubtypeString string         `json:"subtype_string,omitempty"`

	// set after value resolution `column:"value,jsonb"`
	Value                      cty.Value           `json:"-"`
	ValueSourceType            string              `json:"-"`
	ValueSourceFileName        string              `json:"-"`
	ValueSourceStartLineNumber int                 `json:"-"`
	ValueSourceEndLineNumber   int                 `json:"-"`
	ParsingMode                VariableParsingMode `json:"-"`
	Format                     string              `json:"-"`
}

Variable is a struct representing a Variable resource

func NewVariable

func NewVariable(v *RawVariable, mod *Mod) *Variable

func (*Variable) CtyValue

func (v *Variable) CtyValue() (cty.Value, error)

CtyValue implements CtyValueProvider

func (*Variable) Diff

func (v *Variable) Diff(other *Variable) *ModTreeItemDiffs

func (*Variable) Equals

func (v *Variable) Equals(other *Variable) bool

func (*Variable) IsConnectionType added in v1.6.1

func (p *Variable) IsConnectionType() bool

func (*Variable) IsLateBinding added in v1.6.0

func (v *Variable) IsLateBinding() bool

IsLateBinding returns true if the variable has a type which is late binding, i.e. the value is resolved at run time rather than at parse time. These variables are not added to the eval context, but instead are resolved at execution time

func (*Variable) OnDecoded

func (v *Variable) OnDecoded(block *hcl.Block, _ ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*Variable) Required

func (v *Variable) Required() bool

Required returns true if this variable is required to be set by the caller, or false if there is a default value that will be used when it isn't set.

func (*Variable) SetInputValue

func (v *Variable) SetInputValue(value cty.Value, sourceType string, sourceRange tfdiags.SourceRange) error

type VariableParsingMode added in v1.6.0

type VariableParsingMode rune

VariableParsingMode defines how values of a particular variable given by text-only mechanisms (command line arguments and environment variables) should be parsed to produce the final value.

const VariableParseHCL VariableParsingMode = 'H'

VariableParseHCL is a variable parsing mode that attempts to parse the given string as an HCL expression and returns the result.

const VariableParseLiteral VariableParsingMode = 'L'

VariableParseLiteral is a variable parsing mode that just takes the given string directly as a cty.String value.

func (VariableParsingMode) Parse added in v1.6.0

func (m VariableParsingMode) Parse(evalCtx *hcl.EvalContext, name, value string) (cty.Value, hcl.Diagnostics)

Parse uses the receiving parsing mode to process the given variable value string, returning the result along with any diagnostics.

A VariableParsingMode does not know the expected type of the corresponding variable, so it's the caller's responsibility to attempt to convert the result to the appropriate type and return to the user any diagnostics that conversion may produce.

The given name is used to create a synthetic filename in case any diagnostics must be generated about the given string value. This should be the name of the configuration variable whose value will be populated from the given string.

If the returned diagnostics has errors, the returned value may not be valid.

type VariableValidation added in v1.6.0

type VariableValidation struct {
	// Condition is an expression that refers to the variable being tested
	// and contains no other references. The expression must return true
	// to indicate that the value is valid or false to indicate that it is
	// invalid. If the expression produces an error, that's considered a bug
	// in the module defining the validation rule, not an error in the caller.
	Condition hcl.Expression

	// ErrorMessage is one or more full sentences, which would need to be in
	// English for consistency with the rest of the error message output but
	// can in practice be in any language as long as it ends with a period.
	// The message should describe what is required for the condition to return
	// true in a way that would make sense to a caller of the module.
	ErrorMessage string

	DeclRange hcl.Range
}

VariableValidation represents a configuration-defined validation rule for a particular input variable, given as a "validation" block inside a "variable" block.

type VariableValidationFailedError

type VariableValidationFailedError struct {
}

func (VariableValidationFailedError) Error

type VersionConstrainCollection

type VersionConstrainCollection []*ModVersionConstraint

Jump to

Keyboard shortcuts

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