modconfig

package
v0.13.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockTypeMod       = "mod"
	BlockTypeQuery     = "query"
	BlockTypeControl   = "control"
	BlockTypeBenchmark = "benchmark"
	BlockTypeDashboard = "dashboard"
	BlockTypeContainer = "container"
	BlockTypeChart     = "chart"
	BlockTypeCard      = "card"
	BlockTypeHierarchy = "hierarchy"
	BlockTypeImage     = "image"
	BlockTypeInput     = "input"
	BlockTypeTable     = "table"
	BlockTypeText      = "text"
	BlockTypeLocals    = "locals"
	BlockTypeVariable  = "variable"
	BlockTypeParam     = "param"
)
View Source
const (
	ConnectionTypeAggregator = "aggregator"
)

Variables

QueryProviderBlocks is a list of block types which implement QueryProvider

View Source
var ResourceTypeMap = map[string]factoryFunc{
	constants.SqlExtension: func(modPath, filePath string, mod *Mod) (MappableResource, []byte, error) {
		return QueryFromFile(modPath, filePath, mod)
	},
}

Functions

func BuildModResourceName added in v0.5.0

func BuildModResourceName(blockType string, name string) string

func GetAnonymousResourceShortName

func GetAnonymousResourceShortName(block *hcl.Block, parent ModTreeItem) string

func GetCtyTypes added in v0.5.0

func GetCtyTypes(item interface{}) map[string]cty.Type

GetCtyTypes builds a map of cty types for all tagged properties. It is used to convert the struct to a cty value

func GetMonotonicVersionString added in v0.11.0

func GetMonotonicVersionString(v *semver.Version) string

func GetUniqueName

func GetUniqueName(blockType string, parent ModTreeItem) string

GetUniqueName returns a name unique within the scope of this execution tree

func ModVersionFullName added in v0.11.0

func ModVersionFullName(name string, version *semver.Version) string

func ParseModFullName added in v0.11.0

func ParseModFullName(fullName string) (modName string, modVersion *semver.Version, err error)

func PseudoResourceNameFromPath

func PseudoResourceNameFromPath(modPath, filePath string) (string, error)

PseudoResourceNameFromPath converts a filepath into a resource name

It operates as follows:

  1. get filename
  2. remove extension
  3. sluggify, with '_' as the divider

func RegisteredFileExtensions

func RegisteredFileExtensions() []string

func UnqualifiedResourceName added in v0.11.0

func UnqualifiedResourceName(fullName string) string

UnqualifiedResourceName removes the mod prefix from the given name

Types

type Benchmark added in v0.5.0

type Benchmark struct {
	ResourceWithMetadataBase

	ShortName       string
	FullName        string `cty:"name"`
	UnqualifiedName string

	// child names as NamedItem structs - used to allow setting children via the 'children' property
	ChildNames NamedItemList `cty:"child_names"`
	// used for introspection tables
	ChildNameStrings []string `cty:"child_name_strings" column:"children,jsonb"`
	// the actual children
	Children []ModTreeItem

	Description   *string           `cty:"description" hcl:"description" column:"description,text"`
	Documentation *string           `cty:"documentation" hcl:"documentation" column:"documentation,text"`
	Tags          map[string]string `cty:"tags" hcl:"tags,optional" column:"tags,jsonb"`
	Title         *string           `cty:"title" hcl:"title" column:"title,text"`
	References    []*ResourceReference
	Mod           *Mod `cty:"mod"`
	DeclRange     hcl.Range
	Paths         []NodePath `column:"path,jsonb"`

	// dashboard specific properties
	Base  *Benchmark `hcl:"base" json:"-"`
	Width *int       `cty:"width" hcl:"width" column:"width,text"  json:"-"`
	// contains filtered or unexported fields
}

Benchmark is a struct representing the Benchmark resource

func NewBenchmark added in v0.5.0

func NewBenchmark(block *hcl.Block, mod *Mod, parent ModTreeItem) *Benchmark

func (*Benchmark) AddParent added in v0.5.0

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

AddParent implements ModTreeItem

func (*Benchmark) AddReference added in v0.5.0

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

AddReference implements HclResource

func (*Benchmark) CtyValue added in v0.5.0

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

CtyValue implements HclResource

func (*Benchmark) Diff added in v0.13.0

func (b *Benchmark) Diff(other *Benchmark) *DashboardTreeItemDiffs

func (*Benchmark) Equals added in v0.9.0

func (b *Benchmark) Equals(other *Benchmark) bool

func (*Benchmark) GetChildControls added in v0.5.0

func (b *Benchmark) GetChildControls() []*Control

GetChildControls return a flat list of controls underneath the benchmark in the tree

func (*Benchmark) GetChildren added in v0.5.0

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

GetChildren implements ModTreeItem

func (*Benchmark) GetDeclRange added in v0.9.0

func (b *Benchmark) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*Benchmark) GetDescription added in v0.5.0

func (b *Benchmark) GetDescription() string

GetDescription implements ModTreeItem

func (*Benchmark) GetMod added in v0.9.0

func (b *Benchmark) GetMod() *Mod

GetMod implements HclResource

func (*Benchmark) GetParents added in v0.5.0

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

GetParents implements ModTreeItem

func (*Benchmark) GetPaths added in v0.7.1

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

GetPaths implements ModTreeItem

func (*Benchmark) GetTags added in v0.5.0

func (b *Benchmark) GetTags() map[string]string

GetTags implements ModTreeItem

func (*Benchmark) GetTitle added in v0.5.0

func (b *Benchmark) GetTitle() string

GetTitle implements ModTreeItem

func (*Benchmark) GetUnqualifiedName added in v0.13.0

func (b *Benchmark) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*Benchmark) GetWidth added in v0.13.0

func (b *Benchmark) GetWidth() int

GetWidth implements DashboardLeafNode

func (*Benchmark) Name added in v0.5.0

func (b *Benchmark) Name() string

Name implements ModTreeItem, HclResource, ResourceWithMetadata return name in format: '<modname>.control.<shortName>'

func (*Benchmark) OnDecoded added in v0.5.0

func (b *Benchmark) OnDecoded(block *hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*Benchmark) SetPaths added in v0.13.0

func (b *Benchmark) SetPaths()

SetPaths implements ModTreeItem

func (*Benchmark) String added in v0.5.0

func (b *Benchmark) String() string

type Connection added in v0.5.0

type Connection struct {
	// connection name
	Name string
	// The name of plugin as mentioned in config
	PluginShortName string
	// The fully qualified name of the plugin. derived from the short name
	Plugin string
	// Type - supported values: "aggregator"
	Type string `json:"Type,omitempty"`
	// this is a list of names or wildcards which are resolved to connections
	// (only valid for "aggregator" type)
	ConnectionNames []string `json:"Connections,omitempty"`
	// a list of the resolved child connections
	// (only valid for "aggregator" type)
	Connections map[string]*Connection `json:"-"`
	// unparsed HCL of plugin specific connection config
	Config string `json:"Config,omitempty"`

	// options
	Options   *options.Connection `json:"Options,omitempty"`
	DeclRange hcl.Range
}

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

func NewConnection(block *hcl.Block) *Connection

func (*Connection) Equals added in v0.9.0

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

func (*Connection) PopulateChildren added in v0.7.0

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

func (*Connection) SetOptions added in v0.5.0

func (c *Connection) SetOptions(opts options.Options, block *hcl.Block) hcl.Diagnostics

SetOptions sets the options on the connection verify the options object is a valid options type (only options.Connection currently supported)

func (*Connection) String added in v0.5.0

func (c *Connection) String() string

func (*Connection) Validate added in v0.7.0

func (c *Connection) Validate(connectionMap map[string]*Connection) []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 (*Connection) ValidateAggregatorConnection added in v0.7.0

func (c *Connection) ValidateAggregatorConnection(connectionMap map[string]*Connection) []string

type Control added in v0.5.0

type Control struct {
	ResourceWithMetadataBase
	QueryProviderBase

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

	ShortName        string            `json:"-"`
	FullName         string            `cty:"name"  json:"name"`
	Description      *string           `cty:"description" hcl:"description" column:"description,text"  json:"description,omitempty"`
	Documentation    *string           `cty:"documentation" hcl:"documentation"  column:"documentation,text"  json:"documentation,omitempty"`
	SearchPath       *string           `cty:"search_path" hcl:"search_path"  column:"search_path,text"  json:"search_path,omitempty"`
	SearchPathPrefix *string           `cty:"search_path_prefix" hcl:"search_path_prefix"  column:"search_path_prefix,text"  json:"search_path_prefix,omitempty"`
	Severity         *string           `cty:"severity" hcl:"severity"  column:"severity,text"  json:"search_path_prefix,omitempty"`
	Tags             map[string]string `cty:"tags" hcl:"tags,optional"  column:"tags,jsonb"  json:"tags,omitempty"`
	Title            *string           `cty:"title" hcl:"title"  column:"title,text"  json:"title,omitempty"`

	// QueryProvider
	SQL                   *string     `cty:"sql" hcl:"sql" column:"sql,text" json:"-"`
	Query                 *Query      `hcl:"query" json:"-"`
	PreparedStatementName string      `column:"prepared_statement_name,text" json:"-"`
	Args                  *QueryArgs  `cty:"args" column:"args,jsonb" json:"args,omitempty"`
	Params                []*ParamDef `cty:"params" column:"params,jsonb" json:"params,omitempty"`

	References      []*ResourceReference ` json:"-"`
	Mod             *Mod                 `cty:"mod"  json:"-"`
	DeclRange       hcl.Range            `json:"-"`
	UnqualifiedName string               `json:"-"`
	Paths           []NodePath           `json:"-"`

	// dashboard specific properties
	Base  *Control `hcl:"base" json:"-"`
	Width *int     `cty:"width" hcl:"width" column:"width,text" json:"-"`
	// contains filtered or unexported fields
}

Control is a struct representing the Control resource

func NewControl added in v0.5.0

func NewControl(block *hcl.Block, mod *Mod, parent ModTreeItem) *Control

func (*Control) AddParent added in v0.5.0

func (c *Control) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*Control) AddReference added in v0.5.0

func (c *Control) AddReference(ref *ResourceReference)

AddReference implements HclResource

func (*Control) CtyValue added in v0.5.0

func (c *Control) CtyValue() (cty.Value, error)

CtyValue implements HclResource

func (*Control) Diff added in v0.13.0

func (c *Control) Diff(other *Control) *DashboardTreeItemDiffs

func (*Control) Equals added in v0.8.0

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

func (*Control) GetArgs added in v0.13.0

func (c *Control) GetArgs() *QueryArgs

GetArgs implements QueryProvider

func (*Control) GetChildren added in v0.5.0

func (c *Control) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*Control) GetDeclRange added in v0.9.0

func (c *Control) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*Control) GetDescription added in v0.5.0

func (c *Control) GetDescription() string

GetDescription implements ModTreeItem

func (*Control) GetMod added in v0.9.0

func (c *Control) GetMod() *Mod

GetMod implements HclResource

func (*Control) GetParams added in v0.8.0

func (c *Control) GetParams() []*ParamDef

GetParams implements QueryProvider

func (*Control) GetParentNames added in v0.5.0

func (c *Control) GetParentNames() []string

func (*Control) GetParents added in v0.5.0

func (c *Control) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*Control) GetPaths added in v0.7.1

func (c *Control) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*Control) GetPreparedStatementExecuteSQL added in v0.13.0

func (c *Control) GetPreparedStatementExecuteSQL(args *QueryArgs) (string, error)

GetPreparedStatementExecuteSQL implements QueryProvider

func (*Control) GetPreparedStatementName added in v0.9.0

func (c *Control) GetPreparedStatementName() string

GetPreparedStatementName implements QueryProvider

func (*Control) GetQuery added in v0.13.0

func (c *Control) GetQuery() *Query

GetQuery implements QueryProvider

func (*Control) GetSQL added in v0.13.0

func (c *Control) GetSQL() *string

GetSQL implements QueryProvider

func (*Control) GetTags added in v0.5.0

func (c *Control) GetTags() map[string]string

GetTags implements ModTreeItem

func (*Control) GetTitle added in v0.5.0

func (c *Control) GetTitle() string

GetTitle implements ModTreeItem

func (*Control) GetUnqualifiedName added in v0.13.0

func (c *Control) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*Control) GetWidth added in v0.13.0

func (c *Control) GetWidth() int

GetWidth implements DashboardLeafNode

func (*Control) Name added in v0.5.0

func (c *Control) Name() string

Name implements ModTreeItem, HclResource return name in format: 'control.<shortName>'

func (*Control) OnDecoded added in v0.5.0

func (c *Control) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*Control) QualifiedNameWithVersion added in v0.11.0

func (c *Control) QualifiedNameWithVersion() string

QualifiedNameWithVersion returns the name in format: '<modName>@version.control.<shortName>'

func (*Control) SetArgs added in v0.13.0

func (c *Control) SetArgs(args *QueryArgs)

SetArgs implements QueryProvider

func (*Control) SetParams added in v0.13.0

func (c *Control) SetParams(params []*ParamDef)

SetParams implements QueryProvider

func (*Control) SetPaths added in v0.13.0

func (c *Control) SetPaths()

SetPaths implements ModTreeItem

func (*Control) String added in v0.5.0

func (c *Control) String() string

type Dashboard added in v0.13.0

type Dashboard struct {
	ResourceWithMetadataBase

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

	ShortName       string
	FullName        string            `cty:"name"`
	UnqualifiedName string            `cty:"unqualified_name"`
	Title           *string           `cty:"title" hcl:"title" column:"title,text"`
	Width           *int              `cty:"width" hcl:"width"  column:"width,text"`
	Display         *string           `cty:"display" hcl:"display" column:"display,text" json:"display,omitempty"`
	Inputs          []*DashboardInput `cty:"inputs" column:"inputs,jsonb"`
	OnHooks         []*DashboardOn    `cty:"on" hcl:"on,block" json:"on,omitempty"`

	Base *Dashboard `hcl:"base"`

	IsTopLevel bool `column:"is_top_level,bool"`
	Mod        *Mod `cty:"mod"`
	DeclRange  hcl.Range
	Paths      []NodePath `column:"path,jsonb"`
	// store children in a way which can be serialised via cty
	ChildNames []string `cty:"children" column:"children,jsonb"`

	HclType string
	// contains filtered or unexported fields
}

Dashboard is a struct representing the Dashboard and Container resource

func NewDashboard added in v0.13.0

func NewDashboard(block *hcl.Block, mod *Mod, parent ModTreeItem) *Dashboard

func (*Dashboard) AddChild added in v0.13.0

func (d *Dashboard) AddChild(child ModTreeItem)

func (*Dashboard) AddParent added in v0.13.0

func (d *Dashboard) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*Dashboard) AddReference added in v0.13.0

func (d *Dashboard) AddReference(*ResourceReference)

AddReference implements HclResource

func (*Dashboard) BuildRuntimeDependencyTree added in v0.13.0

func (d *Dashboard) BuildRuntimeDependencyTree(workspace ResourceMapsProvider) error

func (*Dashboard) CtyValue added in v0.13.0

func (d *Dashboard) CtyValue() (cty.Value, error)

CtyValue implements HclResource

func (*Dashboard) Diff added in v0.13.0

func (d *Dashboard) Diff(other *Dashboard) *DashboardTreeItemDiffs

func (*Dashboard) Equals added in v0.13.0

func (d *Dashboard) Equals(other *Dashboard) bool

func (*Dashboard) GetChildren added in v0.13.0

func (d *Dashboard) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*Dashboard) GetDeclRange added in v0.13.0

func (d *Dashboard) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*Dashboard) GetDescription added in v0.13.0

func (d *Dashboard) GetDescription() string

GetDescription implements ModTreeItem

func (*Dashboard) GetInput added in v0.13.0

func (d *Dashboard) GetInput(name string) (*DashboardInput, bool)

func (*Dashboard) GetMod added in v0.13.0

func (d *Dashboard) GetMod() *Mod

GetMod implements HclResource

func (*Dashboard) GetParents added in v0.13.0

func (d *Dashboard) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*Dashboard) GetPaths added in v0.13.0

func (d *Dashboard) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*Dashboard) GetTags added in v0.13.0

func (d *Dashboard) GetTags() map[string]string

GetTags implements ModTreeItem

func (*Dashboard) GetTitle added in v0.13.0

func (d *Dashboard) GetTitle() string

GetTitle implements ModTreeItem

func (*Dashboard) GetUnqualifiedName added in v0.13.0

func (d *Dashboard) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*Dashboard) Name added in v0.13.0

func (d *Dashboard) Name() string

Name implements HclResource, ModTreeItem

func (*Dashboard) OnDecoded added in v0.13.0

func (d *Dashboard) OnDecoded(block *hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*Dashboard) SetChildren added in v0.13.0

func (d *Dashboard) SetChildren(children []ModTreeItem)

func (*Dashboard) SetInputs added in v0.13.0

func (d *Dashboard) SetInputs(inputs []*DashboardInput) error

func (*Dashboard) SetPaths added in v0.13.0

func (d *Dashboard) SetPaths()

SetPaths implements ModTreeItem

func (*Dashboard) WalkResources added in v0.13.0

func (d *Dashboard) WalkResources(resourceFunc func(resource HclResource) (bool, error)) error

type DashboardCard added in v0.13.0

type DashboardCard struct {
	ResourceWithMetadataBase
	QueryProviderBase

	FullName        string `cty:"name" json:"-"`
	ShortName       string `json:"-"`
	UnqualifiedName string `json:"-"`

	// these properties are JSON serialised by the parent LeafRun
	Title   *string        `cty:"title" hcl:"title" column:"title,text" json:"-"`
	Width   *int           `cty:"width" hcl:"width" column:"width,text"  json:"-"`
	Type    *string        `cty:"type" hcl:"type" column:"type,text" json:"type,omitempty"`
	Icon    *string        `cty:"icon" hcl:"icon" column:"icon,text" json:"icon,omitempty"`
	Display *string        `cty:"display" hcl:"display" json:"display,omitempty"`
	OnHooks []*DashboardOn `cty:"on" hcl:"on,block" json:"on,omitempty"`

	// QueryProvider
	SQL                   *string     `cty:"sql" hcl:"sql" column:"sql,text" json:"-"`
	Query                 *Query      `hcl:"query" json:"-"`
	PreparedStatementName string      `column:"prepared_statement_name,text" json:"-"`
	Args                  *QueryArgs  `cty:"args" column:"args,jsonb" json:"args,omitempty"`
	Params                []*ParamDef `cty:"params" column:"params,jsonb" json:"params,omitempty"`

	Base *DashboardCard `hcl:"base" json:"-"`

	DeclRange hcl.Range  `json:"-"`
	Mod       *Mod       `cty:"mod" json:"-"`
	Paths     []NodePath `column:"path,jsonb" json:"-"`
	// contains filtered or unexported fields
}

DashboardCard is a struct representing a leaf dashboard node

func NewDashboardCard added in v0.13.0

func NewDashboardCard(block *hcl.Block, mod *Mod, parent ModTreeItem) *DashboardCard

func (*DashboardCard) AddParent added in v0.13.0

func (c *DashboardCard) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*DashboardCard) AddReference added in v0.13.0

func (c *DashboardCard) AddReference(*ResourceReference)

AddReference implements HclResource

func (*DashboardCard) CtyValue added in v0.13.0

func (c *DashboardCard) CtyValue() (cty.Value, error)

CtyValue implements HclResource

func (*DashboardCard) Diff added in v0.13.0

func (*DashboardCard) Equals added in v0.13.0

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

func (*DashboardCard) GetArgs added in v0.13.0

func (c *DashboardCard) GetArgs() *QueryArgs

GetArgs implements QueryProvider

func (*DashboardCard) GetChildren added in v0.13.0

func (c *DashboardCard) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*DashboardCard) GetDeclRange added in v0.13.0

func (c *DashboardCard) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*DashboardCard) GetDescription added in v0.13.0

func (c *DashboardCard) GetDescription() string

GetDescription implements ModTreeItem

func (*DashboardCard) GetMod added in v0.13.0

func (c *DashboardCard) GetMod() *Mod

GetMod implements HclResource

func (*DashboardCard) GetParams added in v0.13.0

func (c *DashboardCard) GetParams() []*ParamDef

GetParams implements QueryProvider

func (*DashboardCard) GetParents added in v0.13.0

func (c *DashboardCard) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*DashboardCard) GetPaths added in v0.13.0

func (c *DashboardCard) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*DashboardCard) GetPreparedStatementExecuteSQL added in v0.13.0

func (c *DashboardCard) GetPreparedStatementExecuteSQL(args *QueryArgs) (string, error)

GetPreparedStatementExecuteSQL implements QueryProvider

func (*DashboardCard) GetPreparedStatementName added in v0.13.0

func (c *DashboardCard) GetPreparedStatementName() string

GetPreparedStatementName implements QueryProvider

func (*DashboardCard) GetQuery added in v0.13.0

func (c *DashboardCard) GetQuery() *Query

GetQuery implements QueryProvider

func (*DashboardCard) GetSQL added in v0.13.0

func (c *DashboardCard) GetSQL() *string

GetSQL implements QueryProvider

func (*DashboardCard) GetTags added in v0.13.0

func (c *DashboardCard) GetTags() map[string]string

GetTags implements ModTreeItem

func (*DashboardCard) GetTitle added in v0.13.0

func (c *DashboardCard) GetTitle() string

GetTitle implements ModTreeItem

func (*DashboardCard) GetUnqualifiedName added in v0.13.0

func (c *DashboardCard) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode

func (*DashboardCard) GetWidth added in v0.13.0

func (c *DashboardCard) GetWidth() int

GetWidth implements DashboardLeafNode

func (*DashboardCard) Name added in v0.13.0

func (c *DashboardCard) Name() string

Name implements HclResource, ModTreeItem return name in format: 'card.<shortName>'

func (*DashboardCard) OnDecoded added in v0.13.0

func (c *DashboardCard) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardCard) SetArgs added in v0.13.0

func (c *DashboardCard) SetArgs(args *QueryArgs)

SetArgs implements QueryProvider

func (*DashboardCard) SetParams added in v0.13.0

func (c *DashboardCard) SetParams(params []*ParamDef)

SetParams implements QueryProvider

func (*DashboardCard) SetPaths added in v0.13.0

func (c *DashboardCard) SetPaths()

SetPaths implements ModTreeItem

type DashboardChart added in v0.13.0

type DashboardChart struct {
	ResourceWithMetadataBase
	QueryProviderBase

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

	FullName        string `cty:"name" json:"-"`
	ShortName       string `json:"-"`
	UnqualifiedName string `json:"-"`

	// these properties are JSON serialised by the parent LeafRun
	Title *string `cty:"title" hcl:"title" column:"title,text" json:"-"`
	Width *int    `cty:"width" hcl:"width" column:"width,text"  json:"-"`

	Type       *string                          `cty:"type" hcl:"type" column:"type,text"  json:"type,omitempty"`
	Legend     *DashboardChartLegend            `cty:"legend" hcl:"legend,block" column:"legend,jsonb" json:"legend"`
	SeriesList DashboardChartSeriesList         `cty:"series_list" hcl:"series,block" column:"series,jsonb" json:"-"`
	Axes       *DashboardChartAxes              `cty:"axes" hcl:"axes,block" column:"axes,jsonb" json:"axes"`
	Grouping   *string                          `cty:"grouping" hcl:"grouping" json:"grouping,omitempty"`
	Transform  *string                          `cty:"transform" hcl:"transform" json:"transform,omitempty"`
	Series     map[string]*DashboardChartSeries `cty:"series" json:"series,omitempty"`
	Display    *string                          `cty:"display" hcl:"display" json:"display,omitempty"`
	OnHooks    []*DashboardOn                   `cty:"on" hcl:"on,block" json:"on,omitempty"`

	// QueryProvider
	SQL                   *string     `cty:"sql" hcl:"sql" column:"sql,text" json:"-"`
	Query                 *Query      `hcl:"query" json:"-"`
	PreparedStatementName string      `column:"prepared_statement_name,text" json:"-"`
	Args                  *QueryArgs  `cty:"args" column:"args,jsonb" json:"args,omitempty"`
	Params                []*ParamDef `cty:"params" column:"params,jsonb" json:"params,omitempty"`

	Base      *DashboardChart `hcl:"base" json:"-"`
	DeclRange hcl.Range       `json:"-"`
	Mod       *Mod            `cty:"mod" json:"-"`
	Paths     []NodePath      `column:"path,jsonb" json:"-"`
	// contains filtered or unexported fields
}

DashboardChart is a struct representing a leaf dashboard node

func NewDashboardChart added in v0.13.0

func NewDashboardChart(block *hcl.Block, mod *Mod, parent ModTreeItem) *DashboardChart

func (*DashboardChart) AddParent added in v0.13.0

func (c *DashboardChart) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*DashboardChart) AddReference added in v0.13.0

func (c *DashboardChart) AddReference(*ResourceReference)

AddReference implements HclResource

func (*DashboardChart) CtyValue added in v0.13.0

func (c *DashboardChart) CtyValue() (cty.Value, error)

CtyValue implements HclResource

func (*DashboardChart) Diff added in v0.13.0

func (*DashboardChart) Equals added in v0.13.0

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

func (*DashboardChart) GetArgs added in v0.13.0

func (c *DashboardChart) GetArgs() *QueryArgs

GetArgs implements QueryProvider

func (*DashboardChart) GetChildren added in v0.13.0

func (c *DashboardChart) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*DashboardChart) GetDeclRange added in v0.13.0

func (c *DashboardChart) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*DashboardChart) GetDescription added in v0.13.0

func (c *DashboardChart) GetDescription() string

GetDescription implements ModTreeItem

func (*DashboardChart) GetMod added in v0.13.0

func (c *DashboardChart) GetMod() *Mod

GetMod implements HclResource

func (*DashboardChart) GetParams added in v0.13.0

func (c *DashboardChart) GetParams() []*ParamDef

GetParams implements QueryProvider

func (*DashboardChart) GetParents added in v0.13.0

func (c *DashboardChart) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*DashboardChart) GetPaths added in v0.13.0

func (c *DashboardChart) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*DashboardChart) GetPreparedStatementExecuteSQL added in v0.13.0

func (c *DashboardChart) GetPreparedStatementExecuteSQL(args *QueryArgs) (string, error)

GetPreparedStatementExecuteSQL implements QueryProvider

func (*DashboardChart) GetPreparedStatementName added in v0.13.0

func (c *DashboardChart) GetPreparedStatementName() string

GetPreparedStatementName implements QueryProvider

func (*DashboardChart) GetQuery added in v0.13.0

func (c *DashboardChart) GetQuery() *Query

GetQuery implements QueryProvider

func (*DashboardChart) GetSQL added in v0.13.0

func (c *DashboardChart) GetSQL() *string

GetSQL implements QueryProvider

func (*DashboardChart) GetTags added in v0.13.0

func (c *DashboardChart) GetTags() map[string]string

GetTags implements ModTreeItem

func (*DashboardChart) GetTitle added in v0.13.0

func (c *DashboardChart) GetTitle() string

GetTitle implements ModTreeItem

func (*DashboardChart) GetUnqualifiedName added in v0.13.0

func (c *DashboardChart) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*DashboardChart) GetWidth added in v0.13.0

func (c *DashboardChart) GetWidth() int

GetWidth implements DashboardLeafNode

func (*DashboardChart) Name added in v0.13.0

func (c *DashboardChart) Name() string

Name implements HclResource, ModTreeItem return name in format: 'chart.<shortName>'

func (*DashboardChart) OnDecoded added in v0.13.0

func (c *DashboardChart) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardChart) SetArgs added in v0.13.0

func (c *DashboardChart) SetArgs(args *QueryArgs)

SetArgs implements QueryProvider

func (*DashboardChart) SetParams added in v0.13.0

func (c *DashboardChart) SetParams(params []*ParamDef)

SetParams implements QueryProvider

func (*DashboardChart) SetPaths added in v0.13.0

func (c *DashboardChart) SetPaths()

SetPaths implements ModTreeItem

type DashboardChartAxes added in v0.13.0

type DashboardChartAxes struct {
	X *DashboardChartAxesX `cty:"x" hcl:"x,block" json:"x,omitempty"`
	Y *DashboardChartAxesY `cty:"y" hcl:"y,block" json:"y,omitempty"`
}

func (*DashboardChartAxes) Equals added in v0.13.0

func (a *DashboardChartAxes) Equals(other *DashboardChartAxes) bool

func (*DashboardChartAxes) Merge added in v0.13.0

func (a *DashboardChartAxes) Merge(other *DashboardChartAxes)

type DashboardChartAxesX added in v0.13.0

type DashboardChartAxesX struct {
	Title  *DashboardChartAxisTitle `cty:"title" hcl:"title,block" json:"title,omitempty"`
	Labels *DashboardChartLabels    `cty:"labels" hcl:"labels,block" json:"labels,omitempty"`
}

func (*DashboardChartAxesX) Equals added in v0.13.0

func (x *DashboardChartAxesX) Equals(other *DashboardChartAxesX) bool

func (*DashboardChartAxesX) Merge added in v0.13.0

func (x *DashboardChartAxesX) Merge(other *DashboardChartAxesX)

type DashboardChartAxesY added in v0.13.0

type DashboardChartAxesY struct {
	Title  *DashboardChartAxisTitle `cty:"title" hcl:"title,block" json:"title,omitempty"`
	Labels *DashboardChartLabels    `cty:"labels" hcl:"labels,block" json:"labels,omitempty"`
	Min    *int                     `cty:"min" hcl:"min" json:"min,omitempty"`
	Max    *int                     `cty:"max" hcl:"max" json:"max,omitempty"`
}

func (*DashboardChartAxesY) Equals added in v0.13.0

func (y *DashboardChartAxesY) Equals(other *DashboardChartAxesY) bool

func (*DashboardChartAxesY) Merge added in v0.13.0

func (y *DashboardChartAxesY) Merge(other *DashboardChartAxesY)

type DashboardChartAxisTitle added in v0.13.0

type DashboardChartAxisTitle struct {
	Display *string `cty:"display" hcl:"display" json:"display,omitempty"`
	Align   *string `cty:"align" hcl:"align" json:"align,omitempty"`
	Value   *string `cty:"value" hcl:"value" json:"value,omitempty"`
}

func (*DashboardChartAxisTitle) Equals added in v0.13.0

func (*DashboardChartAxisTitle) Merge added in v0.13.0

type DashboardChartLabels added in v0.13.0

type DashboardChartLabels struct {
	Display *string `cty:"display" hcl:"display" json:"display,omitempty"`
	Format  *string `cty:"format" hcl:"format" json:"format,omitempty"`
}

func (*DashboardChartLabels) Equals added in v0.13.0

func (*DashboardChartLabels) Merge added in v0.13.0

func (l *DashboardChartLabels) Merge(other *DashboardChartLabels)

type DashboardChartLegend added in v0.13.0

type DashboardChartLegend struct {
	Display  *string `cty:"display" hcl:"display" json:"display,omitempty"`
	Position *string `cty:"position" hcl:"position" json:"position,omitempty"`
}

func (*DashboardChartLegend) Equals added in v0.13.0

func (*DashboardChartLegend) Merge added in v0.13.0

func (l *DashboardChartLegend) Merge(other *DashboardChartLegend)

type DashboardChartSeries added in v0.13.0

type DashboardChartSeries struct {
	Name   string                       `hcl:"name,label" json:"name"`
	Title  *string                      `cty:"title" hcl:"title" json:"title,omitempty"`
	Color  *string                      `cty:"color" hcl:"color" json:"color,omitempty"`
	Points []*DashboardChartSeriesPoint `cty:"points" hcl:"point,block" json:"points,omitempty"`
}

func (DashboardChartSeries) Equals added in v0.13.0

type DashboardChartSeriesList added in v0.13.0

type DashboardChartSeriesList []*DashboardChartSeries

func (*DashboardChartSeriesList) Merge added in v0.13.0

type DashboardChartSeriesPoint added in v0.13.0

type DashboardChartSeriesPoint struct {
	Name  string  `hcl:"name,label" json:"name"`
	Color *string `cty:"color" hcl:"color" json:"color,omitempty"`
}

func (DashboardChartSeriesPoint) Equals added in v0.13.0

type DashboardContainer added in v0.13.0

type DashboardContainer struct {
	ResourceWithMetadataBase

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

	ShortName       string
	FullName        string         `cty:"name"`
	UnqualifiedName string         `cty:"unqualified_name"`
	Title           *string        `cty:"title" hcl:"title" column:"title,text"`
	Width           *int           `cty:"width" hcl:"width"  column:"width,text"`
	Display         *string        `cty:"display" hcl:"display" json:"display,omitempty"`
	OnHooks         []*DashboardOn `cty:"on" hcl:"on,block" json:"on,omitempty"`

	Mod       *Mod `cty:"mod"`
	DeclRange hcl.Range
	Paths     []NodePath `column:"path,jsonb"`
	// store children in a way which can be serialised via cty
	ChildNames []string `cty:"children" column:"children,jsonb"`
	// contains filtered or unexported fields
}

DashboardContainer is a struct representing the Dashboard and Container resource

func NewDashboardContainer added in v0.13.0

func NewDashboardContainer(block *hcl.Block, mod *Mod, parent ModTreeItem) *DashboardContainer

func (*DashboardContainer) AddChild added in v0.13.0

func (c *DashboardContainer) AddChild(child ModTreeItem)

func (*DashboardContainer) AddParent added in v0.13.0

func (c *DashboardContainer) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*DashboardContainer) AddReference added in v0.13.0

func (c *DashboardContainer) AddReference(*ResourceReference)

AddReference implements HclResource

func (*DashboardContainer) CtyValue added in v0.13.0

func (c *DashboardContainer) CtyValue() (cty.Value, error)

CtyValue implements HclResource

func (*DashboardContainer) Diff added in v0.13.0

func (*DashboardContainer) Equals added in v0.13.0

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

func (*DashboardContainer) GetChildren added in v0.13.0

func (c *DashboardContainer) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*DashboardContainer) GetDeclRange added in v0.13.0

func (c *DashboardContainer) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*DashboardContainer) GetDescription added in v0.13.0

func (c *DashboardContainer) GetDescription() string

GetDescription implements ModTreeItem

func (*DashboardContainer) GetMod added in v0.13.0

func (c *DashboardContainer) GetMod() *Mod

GetMod implements HclResource

func (*DashboardContainer) GetParents added in v0.13.0

func (c *DashboardContainer) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*DashboardContainer) GetPaths added in v0.13.0

func (c *DashboardContainer) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*DashboardContainer) GetTags added in v0.13.0

func (c *DashboardContainer) GetTags() map[string]string

GetTags implements ModTreeItem

func (*DashboardContainer) GetTitle added in v0.13.0

func (c *DashboardContainer) GetTitle() string

GetTitle implements ModTreeItem

func (*DashboardContainer) GetUnqualifiedName added in v0.13.0

func (c *DashboardContainer) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*DashboardContainer) Name added in v0.13.0

func (c *DashboardContainer) Name() string

Name implements HclResource, ModTreeItem

func (*DashboardContainer) OnDecoded added in v0.13.0

func (c *DashboardContainer) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardContainer) SetChildren added in v0.13.0

func (c *DashboardContainer) SetChildren(children []ModTreeItem)

func (*DashboardContainer) SetPaths added in v0.13.0

func (c *DashboardContainer) SetPaths()

SetPaths implements ModTreeItem

func (*DashboardContainer) WalkResources added in v0.13.0

func (c *DashboardContainer) WalkResources(resourceFunc func(resource HclResource) (bool, error)) error

type DashboardHierarchy added in v0.13.0

type DashboardHierarchy struct {
	ResourceWithMetadataBase
	QueryProviderBase

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

	FullName        string `cty:"name" json:"-"`
	ShortName       string `json:"-"`
	UnqualifiedName string `json:"-"`

	// these properties are JSON serialised by the parent LeafRun
	Title        *string                                `cty:"title" hcl:"title" column:"title,text" json:"-"`
	Width        *int                                   `cty:"width" hcl:"width" column:"width,text"  json:"-"`
	Type         *string                                `cty:"type" hcl:"type" column:"type,text"  json:"type,omitempty"`
	CategoryList DashboardHierarchyCategoryList         `cty:"category_list" hcl:"category,block" column:"category,jsonb" json:"-"`
	Categories   map[string]*DashboardHierarchyCategory `cty:"categories" json:"categories"`
	Display      *string                                `cty:"display" hcl:"display" json:"display,omitempty"`
	OnHooks      []*DashboardOn                         `cty:"on" hcl:"on,block" json:"on,omitempty"`

	// QueryProvider
	SQL                   *string     `cty:"sql" hcl:"sql" column:"sql,text" json:"-"`
	Query                 *Query      `hcl:"query" json:"-"`
	PreparedStatementName string      `column:"prepared_statement_name,text" json:"-"`
	Args                  *QueryArgs  `cty:"args" column:"args,jsonb" json:"args"`
	Params                []*ParamDef `cty:"params" column:"params,jsonb" json:"params"`

	Base *DashboardHierarchy `hcl:"base" json:"-"`

	DeclRange hcl.Range  `json:"-"`
	Mod       *Mod       `cty:"mod" json:"-"`
	Paths     []NodePath `column:"path,jsonb" json:"-"`
	// contains filtered or unexported fields
}

DashboardHierarchy is a struct representing a leaf dashboard node

func NewDashboardHierarchy added in v0.13.0

func NewDashboardHierarchy(block *hcl.Block, mod *Mod, parent ModTreeItem) *DashboardHierarchy

func (*DashboardHierarchy) AddParent added in v0.13.0

func (h *DashboardHierarchy) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*DashboardHierarchy) AddReference added in v0.13.0

func (h *DashboardHierarchy) AddReference(*ResourceReference)

AddReference implements HclResource

func (*DashboardHierarchy) CtyValue added in v0.13.0

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

CtyValue implements HclResource

func (*DashboardHierarchy) Diff added in v0.13.0

func (*DashboardHierarchy) Equals added in v0.13.0

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

func (*DashboardHierarchy) GetArgs added in v0.13.0

func (h *DashboardHierarchy) GetArgs() *QueryArgs

GetArgs implements QueryProvider

func (*DashboardHierarchy) GetChildren added in v0.13.0

func (h *DashboardHierarchy) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*DashboardHierarchy) GetDeclRange added in v0.13.0

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

GetDeclRange implements HclResource

func (*DashboardHierarchy) GetDescription added in v0.13.0

func (h *DashboardHierarchy) GetDescription() string

GetDescription implements ModTreeItem

func (*DashboardHierarchy) GetMod added in v0.13.0

func (h *DashboardHierarchy) GetMod() *Mod

GetMod implements HclResource

func (*DashboardHierarchy) GetParams added in v0.13.0

func (h *DashboardHierarchy) GetParams() []*ParamDef

GetParams implements QueryProvider

func (*DashboardHierarchy) GetParents added in v0.13.0

func (h *DashboardHierarchy) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*DashboardHierarchy) GetPaths added in v0.13.0

func (h *DashboardHierarchy) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*DashboardHierarchy) GetPreparedStatementExecuteSQL added in v0.13.0

func (h *DashboardHierarchy) GetPreparedStatementExecuteSQL(args *QueryArgs) (string, error)

GetPreparedStatementExecuteSQL implements QueryProvider

func (*DashboardHierarchy) GetPreparedStatementName added in v0.13.0

func (h *DashboardHierarchy) GetPreparedStatementName() string

GetPreparedStatementName implements QueryProvider

func (*DashboardHierarchy) GetQuery added in v0.13.0

func (h *DashboardHierarchy) GetQuery() *Query

GetQuery implements QueryProvider

func (*DashboardHierarchy) GetSQL added in v0.13.0

func (h *DashboardHierarchy) GetSQL() *string

GetSQL implements QueryProvider

func (*DashboardHierarchy) GetTags added in v0.13.0

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

GetTags implements ModTreeItem

func (*DashboardHierarchy) GetTitle added in v0.13.0

func (h *DashboardHierarchy) GetTitle() string

GetTitle implements ModTreeItem

func (*DashboardHierarchy) GetUnqualifiedName added in v0.13.0

func (h *DashboardHierarchy) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*DashboardHierarchy) GetWidth added in v0.13.0

func (h *DashboardHierarchy) GetWidth() int

GetWidth implements DashboardLeafNode

func (*DashboardHierarchy) Name added in v0.13.0

func (h *DashboardHierarchy) Name() string

Name implements HclResource, ModTreeItem return name in format: 'chart.<shortName>'

func (*DashboardHierarchy) OnDecoded added in v0.13.0

func (h *DashboardHierarchy) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardHierarchy) SetArgs added in v0.13.0

func (h *DashboardHierarchy) SetArgs(args *QueryArgs)

SetArgs implements QueryProvider

func (*DashboardHierarchy) SetParams added in v0.13.0

func (h *DashboardHierarchy) SetParams(params []*ParamDef)

SetParams implements QueryProvider

func (*DashboardHierarchy) SetPaths added in v0.13.0

func (h *DashboardHierarchy) SetPaths()

SetPaths implements ModTreeItem

type DashboardHierarchyCategory added in v0.13.0

type DashboardHierarchyCategory struct {
	Name  string  `hcl:"name,label" json:"-"`
	Title *string `cty:"title" hcl:"title" json:"title,omitempty"`
	Color *string `cty:"color" hcl:"color" json:"color,omitempty"`
}

func (DashboardHierarchyCategory) Equals added in v0.13.0

type DashboardHierarchyCategoryList added in v0.13.0

type DashboardHierarchyCategoryList []*DashboardHierarchyCategory

func (DashboardHierarchyCategoryList) Merge added in v0.13.0

type DashboardImage added in v0.13.0

type DashboardImage struct {
	ResourceWithMetadataBase
	QueryProviderBase

	FullName        string `cty:"name" json:"-"`
	ShortName       string `json:"-"`
	UnqualifiedName string `json:"-"`

	// these properties are JSON serialised by the parent LeafRun
	Title   *string        `cty:"title" hcl:"title" column:"title,text" json:"-"`
	Width   *int           `cty:"width" hcl:"width" column:"width,text"  json:"-"`
	Src     *string        `cty:"src" hcl:"src" column:"src,text"  json:"src,omitempty"`
	Alt     *string        `cty:"alt" hcl:"alt" column:"alt,text"  json:"alt,omitempty"`
	Display *string        `cty:"display" hcl:"display" json:"display,omitempty"`
	OnHooks []*DashboardOn `cty:"on" hcl:"on,block" json:"on,omitempty"`

	// QueryProvider
	SQL                   *string     `cty:"sql" hcl:"sql" column:"sql,text" json:"-"`
	Query                 *Query      `hcl:"query" json:"-"`
	PreparedStatementName string      `column:"prepared_statement_name,text" json:"-"`
	Args                  *QueryArgs  `cty:"args" column:"args,jsonb" json:"args"`
	Params                []*ParamDef `cty:"params" column:"params,jsonb" json:"params"`

	Base *DashboardImage `hcl:"base" json:"-"`

	DeclRange hcl.Range  `json:"-"`
	Mod       *Mod       `cty:"mod" json:"-"`
	Paths     []NodePath `column:"path,jsonb" json:"-"`
	// contains filtered or unexported fields
}

DashboardImage is a struct representing a leaf dashboard node

func NewDashboardImage added in v0.13.0

func NewDashboardImage(block *hcl.Block, mod *Mod, parent ModTreeItem) *DashboardImage

func (*DashboardImage) AddParent added in v0.13.0

func (i *DashboardImage) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*DashboardImage) AddReference added in v0.13.0

func (i *DashboardImage) AddReference(*ResourceReference)

AddReference implements HclResource

func (*DashboardImage) CtyValue added in v0.13.0

func (i *DashboardImage) CtyValue() (cty.Value, error)

CtyValue implements HclResource

func (*DashboardImage) Diff added in v0.13.0

func (*DashboardImage) Equals added in v0.13.0

func (i *DashboardImage) Equals(other *DashboardImage) bool

func (*DashboardImage) GetArgs added in v0.13.0

func (i *DashboardImage) GetArgs() *QueryArgs

GetArgs implements QueryProvider

func (*DashboardImage) GetChildren added in v0.13.0

func (i *DashboardImage) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*DashboardImage) GetDeclRange added in v0.13.0

func (i *DashboardImage) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*DashboardImage) GetDescription added in v0.13.0

func (i *DashboardImage) GetDescription() string

GetDescription implements ModTreeItem

func (*DashboardImage) GetMod added in v0.13.0

func (i *DashboardImage) GetMod() *Mod

GetMod implements HclResource

func (*DashboardImage) GetParams added in v0.13.0

func (i *DashboardImage) GetParams() []*ParamDef

GetParams implements QueryProvider

func (*DashboardImage) GetParents added in v0.13.0

func (i *DashboardImage) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*DashboardImage) GetPaths added in v0.13.0

func (i *DashboardImage) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*DashboardImage) GetPreparedStatementExecuteSQL added in v0.13.0

func (i *DashboardImage) GetPreparedStatementExecuteSQL(args *QueryArgs) (string, error)

GetPreparedStatementExecuteSQL implements QueryProvider

func (*DashboardImage) GetPreparedStatementName added in v0.13.0

func (i *DashboardImage) GetPreparedStatementName() string

GetPreparedStatementName implements QueryProvider

func (*DashboardImage) GetQuery added in v0.13.0

func (i *DashboardImage) GetQuery() *Query

GetQuery implements QueryProvider

func (*DashboardImage) GetSQL added in v0.13.0

func (i *DashboardImage) GetSQL() *string

GetSQL implements QueryProvider

func (*DashboardImage) GetTags added in v0.13.0

func (i *DashboardImage) GetTags() map[string]string

GetTags implements ModTreeItem

func (*DashboardImage) GetTitle added in v0.13.0

func (i *DashboardImage) GetTitle() string

GetTitle implements ModTreeItem

func (*DashboardImage) GetUnqualifiedName added in v0.13.0

func (i *DashboardImage) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*DashboardImage) GetWidth added in v0.13.0

func (i *DashboardImage) GetWidth() int

GetWidth implements DashboardLeafNode

func (*DashboardImage) Name added in v0.13.0

func (i *DashboardImage) Name() string

Name implements HclResource, ModTreeItem return name in format: 'image.<shortName>'

func (*DashboardImage) OnDecoded added in v0.13.0

func (i *DashboardImage) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardImage) SetArgs added in v0.13.0

func (i *DashboardImage) SetArgs(args *QueryArgs)

SetArgs implements QueryProvider

func (*DashboardImage) SetParams added in v0.13.0

func (i *DashboardImage) SetParams(params []*ParamDef)

SetParams implements QueryProvider

func (*DashboardImage) SetPaths added in v0.13.0

func (i *DashboardImage) SetPaths()

SetPaths implements ModTreeItem

type DashboardInput added in v0.13.0

type DashboardInput struct {
	ResourceWithMetadataBase
	QueryProviderBase

	FullName        string `cty:"name" json:"-"`
	ShortName       string `json:"-"`
	UnqualifiedName string `cty:"unqualified_name" json:"name"`

	// these properties are JSON serialised by the parent LeafRun
	Title   *string        `cty:"title" hcl:"title" column:"title,text" json:"-"`
	Width   *int           `cty:"width" hcl:"width" column:"width,text"  json:"-"`
	Type    *string        `cty:"type" hcl:"type" column:"type,text"  json:"type,omitempty"`
	Style   *string        `cty:"style" hcl:"style" column:"style,text" json:"style,omitempty"`
	Display *string        `cty:"display" hcl:"display" json:"display,omitempty"`
	OnHooks []*DashboardOn `cty:"on" hcl:"on,block" json:"on,omitempty"`

	// QueryProvider
	SQL                   *string     `cty:"sql" hcl:"sql" column:"sql,text" json:"-"`
	Query                 *Query      `hcl:"query" json:"-"`
	PreparedStatementName string      `column:"prepared_statement_name,text" json:"-"`
	Args                  *QueryArgs  `cty:"args" column:"args,jsonb" json:"args,omitempty"`
	Params                []*ParamDef `cty:"params" column:"params,jsonb" json:"params,omitempty"`

	Base *DashboardInput `hcl:"base" json:"-"`

	DeclRange hcl.Range  `json:"-"`
	Mod       *Mod       `cty:"mod" json:"-"`
	Paths     []NodePath `column:"path,jsonb" json:"-"`
	// contains filtered or unexported fields
}

DashboardInput is a struct representing a leaf dashboard node

func NewDashboardInput added in v0.13.0

func NewDashboardInput(block *hcl.Block, mod *Mod, parent ModTreeItem) *DashboardInput

func (*DashboardInput) AddParent added in v0.13.0

func (i *DashboardInput) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*DashboardInput) AddReference added in v0.13.0

func (i *DashboardInput) AddReference(*ResourceReference)

AddReference implements HclResource

func (*DashboardInput) Clone added in v0.13.0

func (i *DashboardInput) Clone() *DashboardInput

func (*DashboardInput) CtyValue added in v0.13.0

func (i *DashboardInput) CtyValue() (cty.Value, error)

CtyValue implements HclResource

func (*DashboardInput) Diff added in v0.13.0

func (*DashboardInput) Equals added in v0.13.0

func (i *DashboardInput) Equals(other *DashboardInput) bool

func (*DashboardInput) GetArgs added in v0.13.0

func (i *DashboardInput) GetArgs() *QueryArgs

GetArgs implements QueryProvider

func (*DashboardInput) GetChildren added in v0.13.0

func (i *DashboardInput) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*DashboardInput) GetDeclRange added in v0.13.0

func (i *DashboardInput) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*DashboardInput) GetDescription added in v0.13.0

func (i *DashboardInput) GetDescription() string

GetDescription implements ModTreeItem

func (*DashboardInput) GetMod added in v0.13.0

func (i *DashboardInput) GetMod() *Mod

GetMod implements HclResource

func (*DashboardInput) GetParams added in v0.13.0

func (i *DashboardInput) GetParams() []*ParamDef

GetParams implements QueryProvider

func (*DashboardInput) GetParents added in v0.13.0

func (i *DashboardInput) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*DashboardInput) GetPaths added in v0.13.0

func (i *DashboardInput) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*DashboardInput) GetPreparedStatementExecuteSQL added in v0.13.0

func (i *DashboardInput) GetPreparedStatementExecuteSQL(args *QueryArgs) (string, error)

GetPreparedStatementExecuteSQL implements QueryProvider

func (*DashboardInput) GetPreparedStatementName added in v0.13.0

func (i *DashboardInput) GetPreparedStatementName() string

GetPreparedStatementName implements QueryProvider

func (*DashboardInput) GetQuery added in v0.13.0

func (i *DashboardInput) GetQuery() *Query

GetQuery implements QueryProvider

func (*DashboardInput) GetSQL added in v0.13.0

func (i *DashboardInput) GetSQL() *string

GetSQL implements QueryProvider

func (*DashboardInput) GetTags added in v0.13.0

func (i *DashboardInput) GetTags() map[string]string

GetTags implements ModTreeItem

func (*DashboardInput) GetTitle added in v0.13.0

func (i *DashboardInput) GetTitle() string

GetTitle implements ModTreeItem

func (*DashboardInput) GetUnqualifiedName added in v0.13.0

func (i *DashboardInput) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*DashboardInput) GetWidth added in v0.13.0

func (i *DashboardInput) GetWidth() int

GetWidth implements DashboardLeafNode

func (*DashboardInput) Name added in v0.13.0

func (i *DashboardInput) Name() string

Name implements HclResource, ModTreeItem return name in format: 'chart.<shortName>'

func (*DashboardInput) OnDecoded added in v0.13.0

func (i *DashboardInput) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardInput) SetArgs added in v0.13.0

func (i *DashboardInput) SetArgs(args *QueryArgs)

SetArgs implements QueryProvider

func (*DashboardInput) SetDashboard added in v0.13.0

func (i *DashboardInput) SetDashboard(dashboard *Dashboard)

SetDashboard sets the parent dashboard container

func (*DashboardInput) SetParams added in v0.13.0

func (i *DashboardInput) SetParams(params []*ParamDef)

SetParams implements QueryProvider

func (*DashboardInput) SetPaths added in v0.13.0

func (i *DashboardInput) SetPaths()

SetPaths implements ModTreeItem

type DashboardLeafNode added in v0.13.0

type DashboardLeafNode interface {
	Name() string
	GetUnqualifiedName() string
	GetTitle() string
	GetWidth() int
	GetPaths() []NodePath
}

DashboardLeafNode must be implemented by resources may be a leaf node in the dashboard execution tree

type DashboardOn added in v0.13.0

type DashboardOn struct {
	Name    string  `hcl:"name,label" json:"name"`
	Display *string `cty:"display" hcl:"display" json:"display,omitempty"`
}

DashboardOn is a struct representing dashboard hook

func (DashboardOn) Equals added in v0.13.0

func (s DashboardOn) Equals(other *DashboardOn) bool

type DashboardTable added in v0.13.0

type DashboardTable struct {
	ResourceWithMetadataBase
	QueryProviderBase

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

	FullName        string `cty:"name" json:"-"`
	ShortName       string `json:"-"`
	UnqualifiedName string `json:"-"`

	Title      *string                          `cty:"title" hcl:"title" column:"title,text" json:"-"`
	Width      *int                             `cty:"width" hcl:"width" column:"width,text"  json:"-"`
	Type       *string                          `cty:"type" hcl:"type" column:"type,text"  json:"type,omitempty"`
	ColumnList DashboardTableColumnList         `cty:"column_list" hcl:"column,block" column:"columns,jsonb" json:"-"`
	Columns    map[string]*DashboardTableColumn `cty:"columns" json:"columns"`
	Display    *string                          `cty:"display" hcl:"display" json:"display,omitempty"`
	OnHooks    []*DashboardOn                   `cty:"on" hcl:"on,block" json:"on,omitempty"`

	// QueryProvider
	SQL                   *string     `cty:"sql" hcl:"sql" column:"sql,text" json:"-"`
	Query                 *Query      `hcl:"query" json:"-"`
	PreparedStatementName string      `column:"prepared_statement_name,text" json:"-"`
	Args                  *QueryArgs  `cty:"args" column:"args,jsonb" json:"args"`
	Params                []*ParamDef `cty:"params" column:"params,jsonb" json:"params"`

	Base      *DashboardTable `hcl:"base" json:"-"`
	DeclRange hcl.Range       `json:"-"`
	Mod       *Mod            `cty:"mod" json:"-"`
	Paths     []NodePath      `column:"path,jsonb" json:"-"`
	// contains filtered or unexported fields
}

DashboardTable is a struct representing a leaf dashboard node

func NewDashboardTable added in v0.13.0

func NewDashboardTable(block *hcl.Block, mod *Mod, parent ModTreeItem) *DashboardTable

func (*DashboardTable) AddParent added in v0.13.0

func (t *DashboardTable) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*DashboardTable) AddReference added in v0.13.0

func (t *DashboardTable) AddReference(*ResourceReference)

AddReference implements HclResource

func (*DashboardTable) CtyValue added in v0.13.0

func (t *DashboardTable) CtyValue() (cty.Value, error)

CtyValue implements HclResource

func (*DashboardTable) Diff added in v0.13.0

func (*DashboardTable) Equals added in v0.13.0

func (t *DashboardTable) Equals(other *DashboardTable) bool

func (*DashboardTable) GetArgs added in v0.13.0

func (t *DashboardTable) GetArgs() *QueryArgs

GetArgs implements QueryProvider

func (*DashboardTable) GetChildren added in v0.13.0

func (t *DashboardTable) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*DashboardTable) GetDeclRange added in v0.13.0

func (t *DashboardTable) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*DashboardTable) GetDescription added in v0.13.0

func (t *DashboardTable) GetDescription() string

GetDescription implements ModTreeItem

func (*DashboardTable) GetMod added in v0.13.0

func (t *DashboardTable) GetMod() *Mod

GetMod implements HclResource

func (*DashboardTable) GetParams added in v0.13.0

func (t *DashboardTable) GetParams() []*ParamDef

GetParams implements QueryProvider

func (*DashboardTable) GetParents added in v0.13.0

func (t *DashboardTable) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*DashboardTable) GetPaths added in v0.13.0

func (t *DashboardTable) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*DashboardTable) GetPreparedStatementExecuteSQL added in v0.13.0

func (t *DashboardTable) GetPreparedStatementExecuteSQL(args *QueryArgs) (string, error)

GetPreparedStatementExecuteSQL implements QueryProvider

func (*DashboardTable) GetPreparedStatementName added in v0.13.0

func (t *DashboardTable) GetPreparedStatementName() string

GetPreparedStatementName implements QueryProvider

func (*DashboardTable) GetQuery added in v0.13.0

func (t *DashboardTable) GetQuery() *Query

GetQuery implements QueryProvider

func (*DashboardTable) GetSQL added in v0.13.0

func (t *DashboardTable) GetSQL() *string

GetSQL implements QueryProvider

func (*DashboardTable) GetTags added in v0.13.0

func (t *DashboardTable) GetTags() map[string]string

GetTags implements ModTreeItem

func (*DashboardTable) GetTitle added in v0.13.0

func (t *DashboardTable) GetTitle() string

GetTitle implements ModTreeItem, DashboardLeafNode

func (*DashboardTable) GetUnqualifiedName added in v0.13.0

func (t *DashboardTable) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*DashboardTable) GetWidth added in v0.13.0

func (t *DashboardTable) GetWidth() int

GetWidth implements DashboardLeafNode

func (*DashboardTable) Name added in v0.13.0

func (t *DashboardTable) Name() string

Name implements HclResource, ModTreeItem return name in format: 'table.<shortName>'

func (*DashboardTable) OnDecoded added in v0.13.0

func (t *DashboardTable) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardTable) SetArgs added in v0.13.0

func (t *DashboardTable) SetArgs(args *QueryArgs)

SetArgs implements QueryProvider

func (*DashboardTable) SetParams added in v0.13.0

func (t *DashboardTable) SetParams(params []*ParamDef)

SetParams implements QueryProvider

func (*DashboardTable) SetPaths added in v0.13.0

func (t *DashboardTable) SetPaths()

SetPaths implements ModTreeItem

type DashboardTableColumn added in v0.13.0

type DashboardTableColumn struct {
	Name    string  `hcl:"name,label" json:"-"`
	Display *string `cty:"display" hcl:"display" json:"display,omitempty"`
	Wrap    *string `cty:"wrap" hcl:"wrap" json:"wrap,omitempty"`
}

func (DashboardTableColumn) Equals added in v0.13.0

type DashboardTableColumnList added in v0.13.0

type DashboardTableColumnList []*DashboardTableColumn

func (DashboardTableColumnList) Merge added in v0.13.0

type DashboardText added in v0.13.0

type DashboardText struct {
	ResourceWithMetadataBase

	FullName        string `cty:"name" json:"-"`
	ShortName       string `json:"-"`
	UnqualifiedName string `json:"-"`

	// these properties are JSON serialised by the parent LeafRun
	Title   *string        `cty:"title" hcl:"title" column:"title,text" json:"-"`
	Width   *int           `cty:"width" hcl:"width" column:"width,text"  json:"-"`
	Type    *string        `cty:"type" hcl:"type" column:"type,text"  json:"type,omitempty"`
	Value   *string        `cty:"value" hcl:"value" column:"value,text"  json:"value,omitempty"`
	Base    *DashboardText `hcl:"base" json:"-"`
	Display *string        `cty:"display" hcl:"display" json:"display,omitempty"`
	OnHooks []*DashboardOn `cty:"on" hcl:"on,block" json:"on,omitempty"`

	DeclRange hcl.Range  `json:"-"`
	Mod       *Mod       `cty:"mod" json:"-"`
	Paths     []NodePath `column:"path,jsonb" json:"-"`
	// contains filtered or unexported fields
}

DashboardText is a struct representing a leaf dashboard node

func NewDashboardText added in v0.13.0

func NewDashboardText(block *hcl.Block, mod *Mod, parent ModTreeItem) *DashboardText

func (*DashboardText) AddParent added in v0.13.0

func (t *DashboardText) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*DashboardText) AddReference added in v0.13.0

func (t *DashboardText) AddReference(*ResourceReference)

AddReference implements HclResource

func (*DashboardText) CtyValue added in v0.13.0

func (t *DashboardText) CtyValue() (cty.Value, error)

CtyValue implements HclResource

func (*DashboardText) Diff added in v0.13.0

func (*DashboardText) Equals added in v0.13.0

func (t *DashboardText) Equals(other *DashboardText) bool

func (*DashboardText) GetChildren added in v0.13.0

func (t *DashboardText) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*DashboardText) GetDeclRange added in v0.13.0

func (t *DashboardText) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*DashboardText) GetDescription added in v0.13.0

func (t *DashboardText) GetDescription() string

GetDescription implements ModTreeItem

func (*DashboardText) GetMod added in v0.13.0

func (t *DashboardText) GetMod() *Mod

GetMod implements HclResource

func (*DashboardText) GetParents added in v0.13.0

func (t *DashboardText) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*DashboardText) GetPaths added in v0.13.0

func (t *DashboardText) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*DashboardText) GetTags added in v0.13.0

func (t *DashboardText) GetTags() map[string]string

GetTags implements ModTreeItem

func (*DashboardText) GetTitle added in v0.13.0

func (t *DashboardText) GetTitle() string

GetTitle implements ModTreeItem

func (*DashboardText) GetUnqualifiedName added in v0.13.0

func (t *DashboardText) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*DashboardText) GetWidth added in v0.13.0

func (t *DashboardText) GetWidth() int

GetWidth implements DashboardLeafNode

func (*DashboardText) Name added in v0.13.0

func (t *DashboardText) Name() string

Name implements HclResource, ModTreeItem, DashboardLeafNode return name in format: 'text.<shortName>'

func (*DashboardText) OnDecoded added in v0.13.0

func (t *DashboardText) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardText) SetPaths added in v0.13.0

func (t *DashboardText) SetPaths()

SetPaths implements ModTreeItem

type DashboardTreeItemDiffs added in v0.13.0

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

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

func (*DashboardTreeItemDiffs) AddAddedItem added in v0.13.0

func (d *DashboardTreeItemDiffs) AddAddedItem(name string)

func (*DashboardTreeItemDiffs) AddPropertyDiff added in v0.13.0

func (d *DashboardTreeItemDiffs) AddPropertyDiff(propertyName string)

func (*DashboardTreeItemDiffs) AddRemovedItem added in v0.13.0

func (d *DashboardTreeItemDiffs) AddRemovedItem(name string)

func (*DashboardTreeItemDiffs) HasChanges added in v0.13.0

func (d *DashboardTreeItemDiffs) HasChanges() bool

type HclResource added in v0.5.0

type HclResource interface {
	Name() string
	GetUnqualifiedName() string
	CtyValue() (cty.Value, error)
	OnDecoded(*hcl.Block) hcl.Diagnostics
	AddReference(ref *ResourceReference)
	GetDeclRange() *hcl.Range
}

HclResource must be implemented by resources defined in HCL

func GetResource added in v0.13.0

func GetResource(provider ResourceMapsProvider, parsedName *ParsedResourceName) (resource HclResource, found bool)

type Local added in v0.5.0

type Local struct {
	ShortName       string
	FullName        string `cty:"name"`
	UnqualifiedName string

	Value     cty.Value
	DeclRange hcl.Range
	Mod       *Mod `cty:"mod"`

	Paths []NodePath `column:"path,jsonb"`
	// contains filtered or unexported fields
}

Local is a struct representing a Local resource

func NewLocal added in v0.5.0

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

func (*Local) AddParent added in v0.13.0

func (l *Local) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*Local) AddReference added in v0.5.0

func (l *Local) AddReference(*ResourceReference)

AddReference implements HclResource

func (*Local) CtyValue added in v0.5.0

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

CtyValue implements HclResource

func (*Local) Diff added in v0.13.0

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

func (*Local) GetChildren added in v0.13.0

func (l *Local) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*Local) GetDeclRange added in v0.9.0

func (l *Local) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*Local) GetDescription added in v0.13.0

func (l *Local) GetDescription() string

GetDescription implements ModTreeItem

func (*Local) GetMod added in v0.9.0

func (l *Local) GetMod() *Mod

GetMod implements HclResource

func (*Local) GetParents added in v0.13.0

func (l *Local) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*Local) GetPaths added in v0.13.0

func (l *Local) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*Local) GetTags added in v0.13.0

func (l *Local) GetTags() map[string]string

GetTags implements ModTreeItem

func (*Local) GetTitle added in v0.13.0

func (l *Local) GetTitle() string

GetTitle implements ModTreeItem

func (*Local) GetUnqualifiedName added in v0.13.0

func (l *Local) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*Local) Name added in v0.5.0

func (l *Local) Name() string

Name implements HclResource, ResourceWithMetadata

func (*Local) OnDecoded added in v0.5.0

func (l *Local) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*Local) SetPaths added in v0.13.0

func (l *Local) SetPaths()

SetPaths implements ModTreeItem

type MappableResource

type MappableResource interface {
	// InitialiseFromFile creates a mappable resource from a file path
	// It returns the resource, and the raw file data
	InitialiseFromFile(modPath, filePath string) (MappableResource, []byte, error)
	Name() string
	GetUnqualifiedName() string
	GetMetadata() *ResourceMetadata
	SetMetadata(*ResourceMetadata)
	GetDeclRange() *hcl.Range
}

MappableResource must be implemented by resources which can be created directly from a content file (e.g. sql, markdown)

func QueryFromFile

func QueryFromFile(modPath, filePath string, mod *Mod) (MappableResource, []byte, error)

type MissingVariableError added in v0.8.0

type MissingVariableError struct {
	MissingVariables []*Variable
}

func (MissingVariableError) Error added in v0.8.0

func (m MissingVariableError) Error() string

type Mod

type Mod struct {
	ResourceWithMetadataBase

	// ShortName is the mod name, e.g. azure_thrifty
	ShortName string `cty:"short_name" hcl:"name,label"`
	// FullName is the mod name prefixed with 'mod', e.g. mod.azure_thrifty
	FullName string `cty:"name"`
	// ModDependencyPath is the fully qualified mod name, which can be used to 'require'  the mod,
	// e.g. github.com/turbot/steampipe-mod-azure-thrifty
	// This is only set if the mod is installed as a dependency
	ModDependencyPath string `cty:"mod_dependency_path"`

	// attributes
	Categories    []string          `cty:"categories" hcl:"categories,optional" column:"categories,jsonb"`
	Color         *string           `cty:"color" hcl:"color" column:"color,text"`
	Description   *string           `cty:"description" hcl:"description" column:"description,text"`
	Documentation *string           `cty:"documentation" hcl:"documentation" column:"documentation,text"`
	Icon          *string           `cty:"icon" hcl:"icon" column:"icon,text"`
	Tags          map[string]string `cty:"tags" hcl:"tags,optional" column:"tags,jsonb"`
	Title         *string           `cty:"title" hcl:"title" column:"title,text"`

	// list of all blocks referenced by the resource
	References []*ResourceReference

	// blocks
	Require       *Require   `hcl:"require,block"`
	LegacyRequire *Require   `hcl:"requires,block"`
	OpenGraph     *OpenGraph `hcl:"opengraph,block" column:"open_graph,jsonb"`

	VersionString string `cty:"version"`
	Version       *semver.Version

	Queries              map[string]*Query
	Controls             map[string]*Control
	Benchmarks           map[string]*Benchmark
	Dashboards           map[string]*Dashboard
	DashboardContainers  map[string]*DashboardContainer
	DashboardCards       map[string]*DashboardCard
	DashboardCharts      map[string]*DashboardChart
	DashboardHierarchies map[string]*DashboardHierarchy
	DashboardImages      map[string]*DashboardImage
	DashboardInputs      map[string]*DashboardInput
	DashboardTables      map[string]*DashboardTable
	DashboardTexts       map[string]*DashboardText
	Variables            map[string]*Variable
	Locals               map[string]*Local

	// ModPath is the installation location of the mod
	ModPath   string
	DeclRange hcl.Range
	// contains filtered or unexported fields
}

Mod is a struct representing a Mod resource

func CreateDefaultMod added in v0.5.0

func CreateDefaultMod(modPath string) (*Mod, error)

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

func NewMod added in v0.5.0

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

func (*Mod) AddChild added in v0.5.0

func (m *Mod) AddChild(child ModTreeItem) error

AddChild implements ModTreeItem

func (*Mod) AddModDependencies added in v0.11.0

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

func (*Mod) AddParent added in v0.5.0

func (m *Mod) AddParent(ModTreeItem) error

AddParent implements ModTreeItem

func (*Mod) AddPseudoResource added in v0.5.0

func (m *Mod) AddPseudoResource(resource MappableResource)

AddPseudoResource adds the pseudo resource to the mod, as long as there is no existing resource of same name

A pseudo resource ids a resource created by loading a content file (e.g. a SQL file), rather than parsing a HCL definition

func (*Mod) AddReference added in v0.5.0

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

AddReference implements HclResource

func (*Mod) AddResource added in v0.5.0

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

func (*Mod) BuildResourceTree added in v0.7.1

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) CtyValue added in v0.5.0

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

CtyValue implements HclResource

func (*Mod) Equals added in v0.8.0

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

func (*Mod) GetChildren added in v0.5.0

func (m *Mod) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*Mod) GetDeclRange added in v0.9.0

func (m *Mod) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*Mod) GetDescription added in v0.5.0

func (m *Mod) GetDescription() string

GetDescription implements ModTreeItem

func (*Mod) GetMod added in v0.9.0

func (m *Mod) GetMod() *Mod

GetMod implements HclResource

func (*Mod) GetModDependency added in v0.11.0

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

func (*Mod) GetModDependencyPath added in v0.11.0

func (m *Mod) GetModDependencyPath() string

GetModDependencyPath ModDependencyPath if it is set. If not it returns NameWithVersion()

func (*Mod) GetParents added in v0.5.0

func (m *Mod) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*Mod) GetPaths added in v0.7.1

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

GetPaths implements ModTreeItem

func (*Mod) GetResourceMaps added in v0.13.0

func (m *Mod) GetResourceMaps() *WorkspaceResourceMaps

GetResourceMaps implements ResourceMapsProvider

func (*Mod) GetTags added in v0.5.0

func (m *Mod) GetTags() map[string]string

GetTags implements ModTreeItem

func (*Mod) GetTitle added in v0.5.0

func (m *Mod) GetTitle() string

GetTitle implements ModTreeItem

func (*Mod) GetUnqualifiedName added in v0.13.0

func (m *Mod) GetUnqualifiedName() string

GetUnqualifiedName implements ModTreeItem

func (*Mod) HasDependentMods added in v0.11.0

func (m *Mod) HasDependentMods() bool

func (*Mod) IsDefaultMod added in v0.5.0

func (m *Mod) IsDefaultMod() bool

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

func (*Mod) Name

func (m *Mod) Name() string

Name implements ModTreeItem, HclResource

func (*Mod) NameWithVersion added in v0.11.0

func (m *Mod) NameWithVersion() string

func (*Mod) OnDecoded added in v0.5.0

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

OnDecoded implements HclResource

func (*Mod) PopulateResourceMaps

func (m *Mod) PopulateResourceMaps()

func (*Mod) RemoveAllModDependencies added in v0.11.0

func (m *Mod) RemoveAllModDependencies()

func (*Mod) RemoveModDependencies added in v0.11.0

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

func (*Mod) Save added in v0.11.0

func (m *Mod) Save() error

func (*Mod) SetPaths added in v0.13.0

func (m *Mod) SetPaths()

SetPaths implements ModTreeItem

func (*Mod) String

func (m *Mod) String() string

func (*Mod) WalkResources added in v0.13.0

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

TODO [reports] also support error return WalkResources calls resourceFunc for every resource in the mod if any resourceFunc returns false, return immediately

type ModMap

type ModMap map[string]*Mod

ModMap is a map of mod name to mod

func (ModMap) String

func (m ModMap) String() string

type ModTreeItem added in v0.7.1

type ModTreeItem interface {
	AddParent(ModTreeItem) error
	GetChildren() []ModTreeItem
	Name() string
	GetUnqualifiedName() string
	GetTitle() string
	GetDescription() string
	GetTags() map[string]string
	// GetPaths returns an array resource paths
	GetPaths() []NodePath
	SetPaths()
	GetMod() *Mod
}

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

type ModVersionConstraint added in v0.11.0

type ModVersionConstraint struct {
	// the fully qualified mod name, e.g. github.com/turbot/mod1
	Name          string `cty:"name" hcl:"name,label"`
	VersionString string `cty:"version" hcl:"version"`
	// only one of Constraint, Branch and FilePath will be set
	Constraint *versionhelpers.Constraints
	// // NOTE: aliases will be supported in the future
	//Alias string `cty:"alias" hcl:"alias"`
	// the branch to use
	Branch string
	// the local file location to use
	FilePath  string
	DeclRange hcl.Range
}

func NewModVersionConstraint added in v0.11.0

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

func (*ModVersionConstraint) Equals added in v0.11.0

func (*ModVersionConstraint) FullName added in v0.11.0

func (m *ModVersionConstraint) FullName() string

func (*ModVersionConstraint) HasVersion added in v0.11.0

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

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

Initialise parses the version and name properties

func (*ModVersionConstraint) String added in v0.11.0

func (m *ModVersionConstraint) String() string

type ModVersionConstraintCollection added in v0.11.0

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

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

func (ModVersionConstraintCollection) Less added in v0.11.0

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

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

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

func (c NamedItem) String() string

type NamedItemList added in v0.13.0

type NamedItemList []NamedItem

func (NamedItemList) StringList added in v0.13.0

func (l NamedItemList) StringList() []string

type NodePath added in v0.7.1

type NodePath []string

NodePath is a string array representing the parentage of a ModTreeItem

type OpenGraph added in v0.5.0

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

type ParamDef struct {
	Name        string      `cty:"name" json:"name"`
	FullName    string      `cty:"full_name" json:"-"`
	Description *string     `cty:"description" json:"description"`
	RawDefault  interface{} `json:"-"`
	Default     *string     `cty:"default" json:"default"`

	// list of all blocks referenced by the resource
	References []*ResourceReference
	DeclRange  hcl.Range
}

func NewParamDef added in v0.8.0

func NewParamDef(block *hcl.Block) *ParamDef

func (ParamDef) Equals added in v0.8.0

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

func (ParamDef) String added in v0.8.0

func (p ParamDef) String() string

type ParsedPropertyPath added in v0.5.0

type ParsedPropertyPath struct {
	Mod          string
	ItemType     string
	Name         string
	PropertyPath []string
	// optional scope of this property path ("root or parent")
	Scope string
	// contains filtered or unexported fields
}

func ParseResourcePropertyPath added in v0.5.0

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

func (*ParsedPropertyPath) PropertyPathString added in v0.13.0

func (p *ParsedPropertyPath) PropertyPathString() string

func (*ParsedPropertyPath) String added in v0.13.0

func (p *ParsedPropertyPath) String() string

func (*ParsedPropertyPath) ToParsedResourceName added in v0.13.0

func (p *ParsedPropertyPath) ToParsedResourceName() *ParsedResourceName

func (*ParsedPropertyPath) ToResourceName added in v0.13.0

func (p *ParsedPropertyPath) ToResourceName() string

type ParsedResourceName added in v0.5.0

type ParsedResourceName struct {
	Mod      string
	ItemType string
	Name     string
}

func ParseResourceName added in v0.5.0

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

type PluginVersion added in v0.5.0

type PluginVersion struct {
	// the plugin name, as specified in the mod requires block. , e.g. turbot/mod1, aws
	RawName string `cty:"name" hcl:"name,label"`
	// the version STREAM, can be either a major or minor version stream i.e. 1 or 1.1
	VersionString string `cty:"version" hcl:"version,optional"`
	Version       *semver.Version
	// the org and name which are parsed from the raw name
	Org       string
	Name      string
	DeclRange hcl.Range `json:"-"`
}

func (*PluginVersion) FullName added in v0.5.0

func (p *PluginVersion) FullName() string

func (*PluginVersion) Initialise added in v0.9.0

func (p *PluginVersion) Initialise() hcl.Diagnostics

Initialise parses the version and name properties

func (*PluginVersion) ShortName added in v0.6.0

func (p *PluginVersion) ShortName() string

func (*PluginVersion) String added in v0.5.0

func (p *PluginVersion) String() string

type Query

type Query struct {
	ResourceWithMetadataBase
	QueryProviderBase

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

	ShortName string `cty:"short_name"`
	FullName  string `cty:"name"`

	Description           *string           `cty:"description" hcl:"description" column:"description,text"`
	Documentation         *string           `cty:"documentation" hcl:"documentation" column:"documentation,text"`
	SearchPath            *string           `cty:"search_path" hcl:"search_path" column:"search_path,text"`
	SearchPathPrefix      *string           `cty:"search_path_prefix" hcl:"search_path_prefix" column:"search_path_prefix,text"`
	Tags                  map[string]string `cty:"tags" hcl:"tags,optional" column:"tags,jsonb"`
	Title                 *string           `cty:"title" hcl:"title" column:"title,text"`
	PreparedStatementName string            `column:"prepared_statement_name,text" json:"-"`
	SQL                   *string           `cty:"sql" hcl:"sql" column:"sql,text"`

	Params []*ParamDef `cty:"params" column:"params,jsonb"`
	// list of all blocks referenced by the resource
	References []*ResourceReference

	Mod       *Mod `cty:"mod"`
	DeclRange hcl.Range

	UnqualifiedName string
	Paths           []NodePath `column:"path,jsonb"`
	// contains filtered or unexported fields
}

Query is a struct representing the Query resource

func NewQuery added in v0.5.0

func NewQuery(block *hcl.Block, mod *Mod) *Query

func (*Query) AddParent added in v0.13.0

func (q *Query) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*Query) AddReference added in v0.5.0

func (q *Query) AddReference(ref *ResourceReference)

AddReference implements HclResource

func (*Query) CtyValue added in v0.5.0

func (q *Query) CtyValue() (cty.Value, error)

func (*Query) Diff added in v0.13.0

func (q *Query) Diff(other *Query) *DashboardTreeItemDiffs

func (*Query) Equals

func (q *Query) Equals(other *Query) bool

func (*Query) GetArgs added in v0.13.0

func (q *Query) GetArgs() *QueryArgs

GetArgs implements QueryProvider

func (*Query) GetChildren added in v0.13.0

func (q *Query) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*Query) GetDeclRange added in v0.9.0

func (q *Query) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*Query) GetDescription added in v0.13.0

func (q *Query) GetDescription() string

GetDescription implements ModTreeItem

func (*Query) GetMod added in v0.9.0

func (q *Query) GetMod() *Mod

GetMod implements HclResource

func (*Query) GetParams added in v0.8.0

func (q *Query) GetParams() []*ParamDef

GetParams implements QueryProvider

func (*Query) GetParents added in v0.13.0

func (q *Query) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*Query) GetPaths added in v0.13.0

func (q *Query) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*Query) GetPreparedStatementExecuteSQL added in v0.13.0

func (q *Query) GetPreparedStatementExecuteSQL(args *QueryArgs) (string, error)

GetPreparedStatementExecuteSQL implements QueryProvider

func (*Query) GetPreparedStatementName added in v0.9.0

func (q *Query) GetPreparedStatementName() string

GetPreparedStatementName implements QueryProvider

func (*Query) GetQuery added in v0.13.0

func (q *Query) GetQuery() *Query

GetQuery implements QueryProvider

func (*Query) GetSQL added in v0.13.0

func (q *Query) GetSQL() *string

GetSQL implements QueryProvider

func (*Query) GetTags added in v0.13.0

func (q *Query) GetTags() map[string]string

GetTags implements ModTreeItem

func (*Query) GetTitle added in v0.13.0

func (q *Query) GetTitle() string

GetTitle implements ModTreeItem

func (*Query) GetUnqualifiedName added in v0.13.0

func (q *Query) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*Query) InitialiseFromFile

func (q *Query) InitialiseFromFile(modPath, filePath string) (MappableResource, []byte, error)

InitialiseFromFile implements MappableResource

func (*Query) Name

func (q *Query) Name() string

Name implements MappableResource, HclResource

func (*Query) OnDecoded added in v0.5.0

func (q *Query) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*Query) SetArgs added in v0.13.0

func (q *Query) SetArgs(args *QueryArgs)

SetArgs implements QueryProvider

func (*Query) SetParams added in v0.13.0

func (q *Query) SetParams(params []*ParamDef)

SetParams implements QueryProvider

func (*Query) SetPaths added in v0.13.0

func (q *Query) SetPaths()

SetPaths implements ModTreeItem

func (*Query) String

func (q *Query) String() string

type QueryArgs added in v0.8.0

type QueryArgs struct {
	ArgMap     map[string]string    `cty:"args" json:"args"`
	ArgsList   []string             `cty:"args_list" json:"args_list"`
	References []*ResourceReference `cty:"refs" json:"refs"`
}

QueryArgs is a struct which contains the arguments used to invoke a prepared statement these may either be passed by name, in a map, or as a list of positional args NOTE: if both are present the named parameters are used

func NewQueryArgs added in v0.8.0

func NewQueryArgs() *QueryArgs

func (*QueryArgs) Empty added in v0.8.0

func (q *QueryArgs) Empty() bool

func (*QueryArgs) Equals added in v0.8.0

func (q *QueryArgs) Equals(other *QueryArgs) bool

func (*QueryArgs) ResolveAsString added in v0.8.0

func (q *QueryArgs) ResolveAsString(source QueryProvider) (string, error)

ResolveAsString resolves the argument values, falling back on defaults from param definitions in the source (if present) it returns the arg values as a csv string which can be used in a prepared statement invocation (the arg values and param defaults will already have been converted to postgres format)

func (*QueryArgs) String added in v0.8.0

func (q *QueryArgs) String() string

type QueryProvider added in v0.11.0

type QueryProvider interface {
	Name() string
	GetArgs() *QueryArgs
	GetParams() []*ParamDef
	GetSQL() *string
	GetQuery() *Query
	SetArgs(args *QueryArgs)
	SetParams(params []*ParamDef)
	GetPreparedStatementName() string
	GetPreparedStatementExecuteSQL(args *QueryArgs) (string, error)
	// implemented by QueryProviderBase
	AddRuntimeDependencies([]*RuntimeDependency)
	GetRuntimeDependencies() map[string]*RuntimeDependency
	ResolveArgsAsString(QueryProvider, *QueryArgs) (string, error)
}

QueryProvider must be implemented by resources which supports prepared statements, i.e. Control and Query

type QueryProviderBase added in v0.13.0

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

func (*QueryProviderBase) AddRuntimeDependencies added in v0.13.0

func (b *QueryProviderBase) AddRuntimeDependencies(dependencies []*RuntimeDependency)

func (*QueryProviderBase) GetRuntimeDependencies added in v0.13.0

func (b *QueryProviderBase) GetRuntimeDependencies() map[string]*RuntimeDependency

func (*QueryProviderBase) ResolveArgsAsString

func (q *QueryProviderBase) ResolveArgsAsString(source QueryProvider, args *QueryArgs) (string, error)

ResolveArgsAsString resolves the argument values, falling back on defaults from param definitions in the source (if present) it returns the arg values as a csv string which can be used in a prepared statement invocation (the arg values and param defaults will already have been converted to postgres format)

type Require added in v0.11.0

type Require struct {
	SteampipeVersionString string `hcl:"steampipe,optional"`
	SteampipeVersion       *semver.Version
	Plugins                []*PluginVersion        `hcl:"plugin,block"`
	Mods                   []*ModVersionConstraint `hcl:"mod,block"`
	DeclRange              hcl.Range               `json:"-"`
	// contains filtered or unexported fields
}

Require is a struct representing mod dependencies

func NewRequire added in v0.13.0

func NewRequire() (*Require, error)

func (*Require) AddModDependencies added in v0.11.0

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) ContainsMod added in v0.11.0

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

func (*Require) Empty added in v0.11.0

func (r *Require) Empty() bool

func (*Require) GetModDependency added in v0.11.0

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

func (*Require) RemoveAllModDependencies added in v0.11.0

func (r *Require) RemoveAllModDependencies()

func (*Require) RemoveModDependencies added in v0.11.0

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

func (*Require) ValidateSteampipeVersion added in v0.11.0

func (r *Require) ValidateSteampipeVersion(modName string) error

type ResourceDependency added in v0.13.0

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

func (*ResourceDependency) IsRuntimeDependency added in v0.13.0

func (d *ResourceDependency) IsRuntimeDependency() bool

func (*ResourceDependency) String added in v0.13.0

func (d *ResourceDependency) String() string

type ResourceMapsProvider

type ResourceMapsProvider interface {
	GetResourceMaps() *WorkspaceResourceMaps
}

type ResourceMetadata added in v0.5.0

type ResourceMetadata struct {
	ResourceName string `column:"resource_name,text"`
	// mod short name
	ModName          string `column:"mod_name,text"`
	FileName         string `column:"file_name,text"`
	StartLineNumber  int    `column:"start_line_number,integer"`
	EndLineNumber    int    `column:"end_line_number,integer"`
	IsAutoGenerated  bool   `column:"auto_generated,bool"`
	SourceDefinition string `column:"source_definition,text"`
	ModFullName      string
	Anonymous        bool `column:"is_anonymous,bool"`
}

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

func (*ResourceMetadata) SetMod added in v0.5.0

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

SetMod sets the mod name and mod short name

type ResourceReference added in v0.9.0

type ResourceReference struct {
	ResourceWithMetadataBase

	To        string `cty:"reference_to" column:"reference_to,text"`
	From      string `cty:"reference_from" column:"reference_from,text"`
	BlockType string `cty:"from_block_type" column:"from_block_type,text"`
	BlockName string `cty:"from_block_name" column:"from_block_name,text"`
	Attribute string `cty:"from_attribute" column:"from_attribute,text"`
}

func (*ResourceReference) Equals added in v0.9.0

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

func (*ResourceReference) Name added in v0.9.0

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

func (r *ResourceReference) String() string

type ResourceReferenceMap added in v0.9.0

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

func (m ResourceReferenceMap) Add(reference *ResourceReference)

type ResourceWithMetadata added in v0.5.0

type ResourceWithMetadata interface {
	Name() string
	GetMetadata() *ResourceMetadata
	SetMetadata(metadata *ResourceMetadata)
	SetAnonymous(block *hcl.Block)
	IsAnonymous() bool
}

ResourceWithMetadata must be implemented by resources which supports reflection metadata

type ResourceWithMetadataBase added in v0.13.0

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

func (*ResourceWithMetadataBase) GetMetadata added in v0.13.0

func (b *ResourceWithMetadataBase) GetMetadata() *ResourceMetadata

GetMetadata implements ResourceWithMetadata

func (*ResourceWithMetadataBase) IsAnonymous added in v0.13.0

func (b *ResourceWithMetadataBase) IsAnonymous() bool

IsAnonymous implements ResourceWithMetadata

func (*ResourceWithMetadataBase) SetAnonymous added in v0.13.0

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

SetAnonymous implements ResourceWithMetadata

func (*ResourceWithMetadataBase) SetMetadata added in v0.13.0

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

SetMetadata implements ResourceWithMetadata

type RuntimeDependency added in v0.13.0

type RuntimeDependency struct {
	PropertyPath       *ParsedPropertyPath
	SourceResource     HclResource
	TargetPropertyPath []string
	// function to set the target
	SetTargetFunc func(string)
}

func (*RuntimeDependency) ResolveSource added in v0.13.0

func (d *RuntimeDependency) ResolveSource(dashboard *Dashboard, workspace ResourceMapsProvider) error

func (*RuntimeDependency) String added in v0.13.0

func (d *RuntimeDependency) String() string

type Variable added in v0.8.0

type Variable struct {
	ResourceWithMetadataBase

	ShortName string
	FullName  string `column:"name,text"`

	Description    string    `column:"description,text"`
	Default        cty.Value `column:"default_value,jsonb"`
	Type           cty.Type  `column:"var_type,text"`
	DescriptionSet bool

	// set after value resolution `column:"value,jsonb"`
	Value                      cty.Value `column:"value,jsonb"`
	ValueSourceType            string    `column:"value_source,text"`
	ValueSourceFileName        string    `column:"value_source_file_name,text"`
	ValueSourceStartLineNumber int       `column:"value_source_start_line_number,integer"`
	ValueSourceEndLineNumber   int       `column:"value_source_end_line_number,integer"`
	DeclRange                  hcl.Range
	ParsingMode                var_config.VariableParsingMode
	Mod                        *Mod

	Paths           []NodePath `column:"path,jsonb"`
	UnqualifiedName string
	// contains filtered or unexported fields
}

Variable is a struct representing a Variable resource

func NewVariable added in v0.8.0

func NewVariable(v *var_config.Variable, mod *Mod) *Variable

func (*Variable) AddParent added in v0.13.0

func (v *Variable) AddParent(parent ModTreeItem) error

AddParent implements ModTreeItem

func (*Variable) AddReference added in v0.8.0

func (v *Variable) AddReference(*ResourceReference)

AddReference implements HclResource

func (*Variable) CtyValue added in v0.8.0

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

CtyValue implements HclResource

func (*Variable) Diff added in v0.13.0

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

func (*Variable) Equals added in v0.9.0

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

func (*Variable) GetChildren added in v0.13.0

func (v *Variable) GetChildren() []ModTreeItem

GetChildren implements ModTreeItem

func (*Variable) GetDeclRange added in v0.9.0

func (v *Variable) GetDeclRange() *hcl.Range

GetDeclRange implements HclResource

func (*Variable) GetDescription added in v0.13.0

func (v *Variable) GetDescription() string

GetDescription implements ModTreeItem

func (*Variable) GetMod added in v0.9.0

func (v *Variable) GetMod() *Mod

GetMod implements HclResource

func (*Variable) GetParents added in v0.13.0

func (v *Variable) GetParents() []ModTreeItem

GetParents implements ModTreeItem

func (*Variable) GetPaths added in v0.13.0

func (v *Variable) GetPaths() []NodePath

GetPaths implements ModTreeItem

func (*Variable) GetTags added in v0.13.0

func (v *Variable) GetTags() map[string]string

GetTags implements ModTreeItem

func (*Variable) GetTitle added in v0.13.0

func (v *Variable) GetTitle() string

GetTitle implements ModTreeItem

func (*Variable) GetUnqualifiedName added in v0.13.0

func (v *Variable) GetUnqualifiedName() string

GetUnqualifiedName implements DashboardLeafNode, ModTreeItem

func (*Variable) Name added in v0.8.0

func (v *Variable) Name() string

Name implements HclResource, ResourceWithMetadata

func (*Variable) OnDecoded added in v0.8.0

func (v *Variable) OnDecoded(*hcl.Block) hcl.Diagnostics

OnDecoded implements HclResource

func (*Variable) Required added in v0.8.0

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

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

func (*Variable) SetPaths added in v0.13.0

func (v *Variable) SetPaths()

SetPaths implements ModTreeItem

type VariableValidationFailedError added in v0.8.0

type VariableValidationFailedError struct {
}

func (VariableValidationFailedError) Error added in v0.8.0

type VersionConstrainCollection added in v0.11.0

type VersionConstrainCollection []*ModVersionConstraint

type WorkspaceResourceMaps added in v0.5.0

type WorkspaceResourceMaps struct {
	// the parent mod
	Mod *Mod
	// all mods (including deps)
	Mods                 map[string]*Mod
	Queries              map[string]*Query
	Controls             map[string]*Control
	Benchmarks           map[string]*Benchmark
	Variables            map[string]*Variable
	Dashboards           map[string]*Dashboard
	DashboardContainers  map[string]*DashboardContainer
	DashboardCards       map[string]*DashboardCard
	DashboardCharts      map[string]*DashboardChart
	DashboardHierarchies map[string]*DashboardHierarchy
	DashboardImages      map[string]*DashboardImage
	DashboardInputs      map[string]*DashboardInput
	DashboardTables      map[string]*DashboardTable
	DashboardTexts       map[string]*DashboardText
	References           map[string]*ResourceReference

	LocalQueries    map[string]*Query
	LocalControls   map[string]*Control
	LocalBenchmarks map[string]*Benchmark
}

WorkspaceResourceMaps is a struct containing maps of all mod resource types This is provided to avoid db needing to reference workspace package

func CreateWorkspaceResourceMapForMod

func CreateWorkspaceResourceMapForMod(mod *Mod) *WorkspaceResourceMaps

func CreateWorkspaceResourceMapForQueryProviders

func CreateWorkspaceResourceMapForQueryProviders(queryProviders []QueryProvider) *WorkspaceResourceMaps

func (*WorkspaceResourceMaps) Empty added in v0.10.0

func (m *WorkspaceResourceMaps) Empty() bool

func (*WorkspaceResourceMaps) Equals added in v0.8.0

func (*WorkspaceResourceMaps) PopulateReferences added in v0.9.0

func (m *WorkspaceResourceMaps) PopulateReferences()

func (*WorkspaceResourceMaps) QueryProviders

func (m *WorkspaceResourceMaps) QueryProviders() []QueryProvider

type WorkspaceResources added in v0.8.0

type WorkspaceResources struct {
	Query     map[string]bool
	Control   map[string]bool
	Benchmark map[string]bool
}

func NewWorkspaceResources added in v0.8.0

func NewWorkspaceResources() *WorkspaceResources

func (*WorkspaceResources) GetSortedBenchmarksAndControlNames added in v0.8.0

func (w *WorkspaceResources) GetSortedBenchmarksAndControlNames() []string

GetSortedBenchmarksAndControlNames gives back a list of the benchmarks and controls in the current workspace. The list is sorted alphabetically - with the benchmarks first

func (*WorkspaceResources) GetSortedNamedQueryNames added in v0.8.0

func (w *WorkspaceResources) GetSortedNamedQueryNames() []string

func (*WorkspaceResources) Merge added in v0.8.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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