Documentation ¶
Index ¶
- Constants
- Variables
- func BuildModResourceName(blockType string, name string) string
- func GetCtyTypes(item interface{}) map[string]cty.Type
- func GetPreparedStatementExecuteSQL(source PreparedStatementProvider, args *QueryArgs) (string, error)
- func PropertyPathToResourceName(propertyPath string) (string, error)
- func PseudoResourceNameFromPath(modPath, filePath string) (string, error)
- func RegisteredFileExtensions() []string
- type Benchmark
- func (b *Benchmark) AddChild(child ModTreeItem) error
- func (b *Benchmark) AddParent(parent ModTreeItem) error
- func (b *Benchmark) AddReference(ref *ResourceReference)
- func (b *Benchmark) CtyValue() (cty.Value, error)
- func (b *Benchmark) Equals(other *Benchmark) bool
- func (b *Benchmark) GetChildControls() []*Control
- func (b *Benchmark) GetChildren() []ModTreeItem
- func (b *Benchmark) GetDeclRange() *hcl.Range
- func (b *Benchmark) GetDescription() string
- func (b *Benchmark) GetMetadata() *ResourceMetadata
- func (b *Benchmark) GetMod() *Mod
- func (b *Benchmark) GetParents() []ModTreeItem
- func (b *Benchmark) GetPaths() []NodePath
- func (b *Benchmark) GetTags() map[string]string
- func (b *Benchmark) GetTitle() string
- func (b *Benchmark) Name() string
- func (b *Benchmark) OnDecoded(block *hcl.Block) hcl.Diagnostics
- func (b *Benchmark) QualifiedName() string
- func (b *Benchmark) SetMetadata(metadata *ResourceMetadata)
- func (b *Benchmark) SetMod(mod *Mod)
- func (b *Benchmark) String() string
- type Connection
- func (c *Connection) Equals(other *Connection) bool
- func (c *Connection) PopulateChildren(connectionMap map[string]*Connection)
- func (c *Connection) SetOptions(opts options.Options, block *hcl.Block) hcl.Diagnostics
- func (c *Connection) String() string
- func (c *Connection) Validate(connectionMap map[string]*Connection) []string
- func (c *Connection) ValidateAggregatorConnection(connectionMap map[string]*Connection) []string
- type Control
- func (c *Control) AddChild(child ModTreeItem) error
- func (c *Control) AddParent(parent ModTreeItem) error
- func (c *Control) AddReference(ref *ResourceReference)
- func (c *Control) CtyValue() (cty.Value, error)
- func (c *Control) Equals(other *Control) bool
- func (c *Control) GetChildren() []ModTreeItem
- func (c *Control) GetDeclRange() *hcl.Range
- func (c *Control) GetDescription() string
- func (c *Control) GetMetadata() *ResourceMetadata
- func (c *Control) GetMod() *Mod
- func (c *Control) GetParams() []*ParamDef
- func (c *Control) GetParentNames() []string
- func (c *Control) GetParents() []ModTreeItem
- func (c *Control) GetPaths() []NodePath
- func (c *Control) GetPreparedStatementName() string
- func (c *Control) GetTags() map[string]string
- func (c *Control) GetTitle() string
- func (c *Control) ModName() string
- func (c *Control) Name() string
- func (c *Control) OnDecoded(*hcl.Block) hcl.Diagnostics
- func (c *Control) QualifiedName() string
- func (c *Control) SetMetadata(metadata *ResourceMetadata)
- func (c *Control) SetMod(mod *Mod)
- func (c *Control) String() string
- type HclResource
- type Local
- func (l *Local) AddReference(*ResourceReference)
- func (l *Local) CtyValue() (cty.Value, error)
- func (l *Local) GetDeclRange() *hcl.Range
- func (l *Local) GetMetadata() *ResourceMetadata
- func (l *Local) GetMod() *Mod
- func (l *Local) Name() string
- func (l *Local) OnDecoded(*hcl.Block) hcl.Diagnostics
- func (l *Local) SetMetadata(metadata *ResourceMetadata)
- func (l *Local) SetMod(mod *Mod)
- type MappableResource
- type MissingVariableError
- type Mod
- func (m *Mod) AddChild(child ModTreeItem) error
- func (m *Mod) AddParent(ModTreeItem) error
- func (m *Mod) AddPseudoResource(resource MappableResource)
- func (m *Mod) AddReference(ref *ResourceReference)
- func (m *Mod) AddResource(item HclResource) hcl.Diagnostics
- func (m *Mod) BuildResourceTree() error
- func (m *Mod) CtyValue() (cty.Value, error)
- func (m *Mod) Equals(other *Mod) bool
- func (m *Mod) GetChildControls() []*Control
- func (m *Mod) GetChildren() []ModTreeItem
- func (m *Mod) GetDeclRange() *hcl.Range
- func (m *Mod) GetDescription() string
- func (m *Mod) GetMetadata() *ResourceMetadata
- func (m *Mod) GetMod() *Mod
- func (m *Mod) GetParents() []ModTreeItem
- func (m *Mod) GetPaths() []NodePath
- func (m *Mod) GetTags() map[string]string
- func (m *Mod) GetTitle() string
- func (m *Mod) IsDefaultMod() bool
- func (m *Mod) Name() string
- func (m *Mod) OnDecoded(*hcl.Block) hcl.Diagnostics
- func (m *Mod) SetMetadata(metadata *ResourceMetadata)
- func (m *Mod) SetMod(*Mod)
- func (m *Mod) String() string
- type ModMap
- type ModTreeItem
- type ModVersion
- type NamedItem
- type NodePath
- type OpenGraph
- type Panel
- func (p *Panel) AddChild(child ModTreeItem) error
- func (p *Panel) AddParent(parent ModTreeItem) error
- func (p *Panel) AddReference(*ResourceReference)
- func (p *Panel) CtyValue() (cty.Value, error)
- func (p *Panel) Diff(new *Panel) *ReportTreeItemDiffs
- func (p *Panel) GetChildren() []ModTreeItem
- func (p *Panel) GetDeclRange() *hcl.Range
- func (p *Panel) GetDescription() string
- func (p *Panel) GetMetadata() *ResourceMetadata
- func (p *Panel) GetMod() *Mod
- func (p *Panel) GetParents() []ModTreeItem
- func (p *Panel) GetPaths() []NodePath
- func (p *Panel) GetTags() map[string]string
- func (p *Panel) GetTitle() string
- func (p *Panel) InitialiseFromFile(modPath, filePath string) (MappableResource, []byte, error)
- func (p *Panel) Name() string
- func (p *Panel) OnDecoded(*hcl.Block) hcl.Diagnostics
- func (p *Panel) QualifiedName() string
- func (p *Panel) SetMetadata(metadata *ResourceMetadata)
- func (p *Panel) SetMod(mod *Mod)
- type ParamDef
- type ParsedPropertyPath
- type ParsedResourceName
- type PluginVersion
- type PreparedStatementProvider
- type Query
- func (q *Query) AddReference(ref *ResourceReference)
- func (q *Query) CtyValue() (cty.Value, error)
- func (q *Query) Equals(other *Query) bool
- func (q *Query) GetDeclRange() *hcl.Range
- func (q *Query) GetMetadata() *ResourceMetadata
- func (q *Query) GetMod() *Mod
- func (q *Query) GetParams() []*ParamDef
- func (q *Query) GetPreparedStatementName() string
- func (q *Query) InitialiseFromFile(modPath, filePath string) (MappableResource, []byte, error)
- func (q *Query) ModName() string
- func (q *Query) Name() string
- func (q *Query) OnDecoded(*hcl.Block) hcl.Diagnostics
- func (q *Query) QualifiedName() string
- func (q *Query) SetMetadata(metadata *ResourceMetadata)
- func (q *Query) SetMod(mod *Mod)
- func (q *Query) String() string
- type QueryArgs
- type Report
- func (r *Report) AddChild(child ModTreeItem) error
- func (r *Report) AddParent(parent ModTreeItem) error
- func (r *Report) AddReference(*ResourceReference)
- func (r *Report) CtyValue() (cty.Value, error)
- func (r *Report) Diff(new *Report) *ReportTreeItemDiffs
- func (r *Report) GetChildren() []ModTreeItem
- func (r *Report) GetDeclRange() *hcl.Range
- func (r *Report) GetDescription() string
- func (r *Report) GetMetadata() *ResourceMetadata
- func (r *Report) GetMod() *Mod
- func (r *Report) GetParents() []ModTreeItem
- func (r *Report) GetPaths() []NodePath
- func (r *Report) GetTags() map[string]string
- func (r *Report) GetTitle() string
- func (r *Report) Name() string
- func (r *Report) OnDecoded(*hcl.Block) hcl.Diagnostics
- func (r *Report) QualifiedName() string
- func (r *Report) SetMetadata(metadata *ResourceMetadata)
- func (r *Report) SetMod(mod *Mod)
- type ReportTreeItemDiffs
- type Requires
- type ResourceMetadata
- type ResourceReference
- type ResourceReferenceMap
- type ResourceWithMetadata
- type Variable
- func (v *Variable) AddReference(*ResourceReference)
- func (v *Variable) CtyValue() (cty.Value, error)
- func (v *Variable) Equals(other *Variable) bool
- func (v *Variable) GetDeclRange() *hcl.Range
- func (v *Variable) GetMetadata() *ResourceMetadata
- func (v *Variable) GetMod() *Mod
- func (v *Variable) Name() string
- func (v *Variable) OnDecoded(*hcl.Block) hcl.Diagnostics
- func (v *Variable) QualifiedName() string
- func (v *Variable) Required() bool
- func (v *Variable) SetInputValue(value cty.Value, sourceType string, sourceRange tfdiags.SourceRange)
- func (v *Variable) SetMetadata(metadata *ResourceMetadata)
- func (v *Variable) SetMod(mod *Mod)
- type VariableValidationFailedError
- type WorkspaceResourceMaps
- type WorkspaceResources
Constants ¶
const ( BlockTypeMod = "mod" BlockTypeQuery = "query" BlockTypeControl = "control" BlockTypeBenchmark = "benchmark" BlockTypeReport = "report" BlockTypePanel = "panel" BlockTypeLocals = "locals" BlockTypeVariable = "variable" BlockTypeParam = "param" )
const (
ConnectionTypeAggregator = "aggregator"
)
Variables ¶
var ResourceTypeMap = map[string]factoryFunc{ constants.SqlExtension: func(modPath, filePath string) (MappableResource, []byte, error) { return QueryFromFile(modPath, filePath) }, }
Functions ¶
func BuildModResourceName ¶ added in v0.5.0
func GetCtyTypes ¶ added in v0.5.0
GetCtyTypes builds a map of cty types for all tagged properties. It is used to convert the struct to a cty value
func GetPreparedStatementExecuteSQL ¶ added in v0.8.0
func GetPreparedStatementExecuteSQL(source PreparedStatementProvider, args *QueryArgs) (string, error)
GetPreparedStatementExecuteSQL return the SQLs to run the query as a prepared statement
func PropertyPathToResourceName ¶ added in v0.5.0
func PseudoResourceNameFromPath ¶
PseudoResourceNameFromPath converts a filepath into a resource name
It operates as follows:
- get filename
- remove extension
- sluggify, with '_' as the divider
func RegisteredFileExtensions ¶
func RegisteredFileExtensions() []string
Types ¶
type Benchmark ¶ added in v0.5.0
type Benchmark struct { ShortName string FullName string `cty:"name"` ChildNames *[]NamedItem `cty:"children" hcl:"children"` 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" column:"tags,jsonb"` Title *string `cty:"title" hcl:"title" column:"title,text"` // list of all block referenced by the resource References []*ResourceReference Mod *Mod `cty:"mod"` ChildNameStrings []string `column:"children,jsonb"` DeclRange hcl.Range // 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) *Benchmark
func (*Benchmark) AddChild ¶ added in v0.5.0
func (b *Benchmark) AddChild(child ModTreeItem) error
AddChild implements ModTreeItem
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) GetChildControls ¶ added in v0.5.0
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
GetDescription implements ModTreeItem
func (*Benchmark) GetMetadata ¶ added in v0.5.0
func (b *Benchmark) GetMetadata() *ResourceMetadata
GetMetadata implements ResourceWithMetadata
func (*Benchmark) GetParents ¶ added in v0.5.0
func (b *Benchmark) GetParents() []ModTreeItem
GetParents implements ModTreeItem
func (*Benchmark) Name ¶ added in v0.5.0
Name implements ModTreeItem, HclResource, ResourceWithMetadata return name in format: 'control.<shortName>'
func (*Benchmark) OnDecoded ¶ added in v0.5.0
func (b *Benchmark) OnDecoded(block *hcl.Block) hcl.Diagnostics
OnDecoded implements HclResource
func (*Benchmark) QualifiedName ¶ added in v0.5.0
QualifiedName returns the name in format: '<modName>.control.<shortName>'
func (*Benchmark) SetMetadata ¶ added in v0.5.0
func (b *Benchmark) SetMetadata(metadata *ResourceMetadata)
SetMetadata implements ResourceWithMetadata
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 { ShortName string FullName string `cty:"name"` Description *string `cty:"description" column:"description,text"` Documentation *string `cty:"documentation" column:"documentation,text"` SearchPath *string `cty:"search_path" column:"search_path,text"` SearchPathPrefix *string `cty:"search_path_prefix" column:"search_path_prefix,text"` Severity *string `cty:"severity" column:"severity,text"` SQL *string `cty:"sql" column:"sql,text"` Tags *map[string]string `cty:"tags" column:"tags,jsonb"` Title *string `cty:"title" column:"title,text"` Query *Query // args // arguments may be specified by either a map of named args or as a list of positional args // we apply special decode logic to convert the params block into a QueryArgs object // with either an args map or list assigned Args *QueryArgs `cty:"args" column:"args,jsonb"` Params []*ParamDef `cty:"params" column:"params,jsonb"` // list of all blocks referenced by the resource References []*ResourceReference Mod *Mod `cty:"mod"` DeclRange hcl.Range PreparedStatementName string `column:"prepared_statement_name,text"` // 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) *Control
func (*Control) AddChild ¶ added in v0.5.0
func (c *Control) AddChild(child ModTreeItem) error
AddChild implements ModTreeItem - controls cannot have children so just return error
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) 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
GetDescription implements ModTreeItem
func (*Control) GetMetadata ¶ added in v0.5.0
func (c *Control) GetMetadata() *ResourceMetadata
GetMetadata implements ResourceWithMetadata
func (*Control) GetParentNames ¶ added in v0.5.0
func (*Control) GetParents ¶ added in v0.5.0
func (c *Control) GetParents() []ModTreeItem
GetParents implements ModTreeItem
func (*Control) GetPreparedStatementName ¶ added in v0.9.0
GetPreparedStatementName implements PreparedStatementProvider
func (*Control) Name ¶ added in v0.5.0
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) QualifiedName ¶ added in v0.5.0
QualifiedName returns the name in format: '<modName>.control.<shortName>'
func (*Control) SetMetadata ¶ added in v0.5.0
func (c *Control) SetMetadata(metadata *ResourceMetadata)
SetMetadata implements ResourceWithMetadata
type HclResource ¶ added in v0.5.0
type HclResource interface { Name() string CtyValue() (cty.Value, error) OnDecoded(*hcl.Block) hcl.Diagnostics AddReference(ref *ResourceReference) SetMod(*Mod) GetMod() *Mod GetDeclRange() *hcl.Range }
HclResource must be implemented by resources defined in HCL
type Local ¶ added in v0.5.0
type Local struct { ShortName string FullName string `cty:"name"` Value cty.Value DeclRange hcl.Range Mod *Mod `cty:"mod"` // contains filtered or unexported fields }
Local is a struct representing a Local resource
func (*Local) AddReference ¶ added in v0.5.0
func (l *Local) AddReference(*ResourceReference)
AddReference implements HclResource
func (*Local) GetDeclRange ¶ added in v0.9.0
func (l *Local) GetDeclRange() *hcl.Range
GetDeclRange implements HclResource
func (*Local) GetMetadata ¶ added in v0.5.0
func (l *Local) GetMetadata() *ResourceMetadata
GetMetadata implements ResourceWithMetadata
func (*Local) OnDecoded ¶ added in v0.5.0
func (l *Local) OnDecoded(*hcl.Block) hcl.Diagnostics
OnDecoded implements HclResource
func (*Local) SetMetadata ¶ added in v0.5.0
func (l *Local) SetMetadata(metadata *ResourceMetadata)
SetMetadata implements ResourceWithMetadata
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 SetMod(*Mod) GetMetadata() *ResourceMetadata SetMetadata(*ResourceMetadata) }
MappableResource must be implemented by resources which can be created directly from a content file (e.g. sql, markdown)
func PanelFromFile ¶ added in v0.7.1
func PanelFromFile(modPath, filePath string) (MappableResource, []byte, error)
PanelFromFile :: factory function
func QueryFromFile ¶
func QueryFromFile(modPath, filePath string) (MappableResource, []byte, error)
QueryFromFile :: factory function
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 { // 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" 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" column:"tags,jsonb"` Title *string `cty:"title" hcl:"title" column:"title,text"` // list of all blocks referenced by the resource References []*ResourceReference // blocks Requires *Requires `hcl:"requires,block"` OpenGraph *OpenGraph `hcl:"opengraph,block" column:"open_graph,jsonb"` Version *goVersion.Version Queries map[string]*Query Controls map[string]*Control Benchmarks map[string]*Benchmark Reports map[string]*Report Panels map[string]*Panel Variables map[string]*Variable Locals map[string]*Local // flat list of all resources AllResources map[string]HclResource // 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
CreateDefaultMod creates a default mod created for a workspace with no mod definition
func (*Mod) AddChild ¶ added in v0.5.0
func (m *Mod) AddChild(child ModTreeItem) error
AddChild implements ModTreeItem
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
BuildResourceTree builds the control tree structure by setting the parent property for each control and benchmar NOTE: this also builds the sorted benchmark list
func (*Mod) GetChildControls ¶ added in v0.5.0
GetChildControls return a flat list of controls underneath the mod
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
GetDescription implements ModTreeItem
func (*Mod) GetMetadata ¶ added in v0.5.0
func (m *Mod) GetMetadata() *ResourceMetadata
GetMetadata implements ResourceWithMetadata
func (*Mod) GetParents ¶ added in v0.5.0
func (m *Mod) GetParents() []ModTreeItem
GetParents implements ModTreeItem
func (*Mod) IsDefaultMod ¶ added in v0.5.0
IsDefaultMod returns whether this mod is a default mod created for a workspace with no mod definition
func (*Mod) OnDecoded ¶ added in v0.5.0
func (m *Mod) OnDecoded(*hcl.Block) hcl.Diagnostics
OnDecoded implements HclResource
func (*Mod) SetMetadata ¶ added in v0.5.0
func (m *Mod) SetMetadata(metadata *ResourceMetadata)
SetMetadata implements ResourceWithMetadata
type ModTreeItem ¶ added in v0.7.1
type ModTreeItem interface { AddParent(ModTreeItem) error AddChild(child ModTreeItem) error GetChildren() []ModTreeItem Name() string GetTitle() string GetDescription() string GetTags() map[string]string // GetPaths returns an array resource paths GetPaths() []NodePath }
ModTreeItem must be implemented by elements of the mod resource hierarchy i.e. Control, Benchmark, Report, Panel
type ModVersion ¶
type ModVersion 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"` Alias *string `cty:"alias" hcl:"alias,optional"` // only one of VersionConstraint, Branch and FilePath will be set VersionConstraint *goVersion.Version // the branch to use Branch string // the local file location to use FilePath string DeclRange hcl.Range }
func (*ModVersion) FullName ¶
func (m *ModVersion) FullName() string
func (*ModVersion) HasVersion ¶
func (m *ModVersion) 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 (*ModVersion) Initialise ¶ added in v0.9.0
func (m *ModVersion) Initialise() hcl.Diagnostics
Initialise parses the version and name properties
func (*ModVersion) String ¶
func (m *ModVersion) String() 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 Panel ¶ added in v0.7.1
type Panel struct { FullName string `cty:"name"` ShortName string Title *string `hcl:"title"` Type *string `hcl:"type"` Width *int `hcl:"width"` Height *int `hcl:"height"` Source *string `hcl:"source"` SQL *string `hcl:"source"` Text *string `hcl:"text"` Reports []*Report Panels []*Panel DeclRange hcl.Range Mod *Mod `cty:"mod"` // contains filtered or unexported fields }
Panel is a struct representing the Report resource
func (*Panel) AddChild ¶ added in v0.7.1
func (p *Panel) AddChild(child ModTreeItem) error
AddChild implements ModTreeItem
func (*Panel) AddParent ¶ added in v0.7.1
func (p *Panel) AddParent(parent ModTreeItem) error
AddParent implements ModTreeItem
func (*Panel) AddReference ¶ added in v0.7.1
func (p *Panel) AddReference(*ResourceReference)
AddReference implements HclResource
func (*Panel) Diff ¶ added in v0.7.1
func (p *Panel) Diff(new *Panel) *ReportTreeItemDiffs
func (*Panel) GetChildren ¶ added in v0.7.1
func (p *Panel) GetChildren() []ModTreeItem
GetChildren implements ModTreeItem
func (*Panel) GetDeclRange ¶ added in v0.9.0
func (p *Panel) GetDeclRange() *hcl.Range
GetDeclRange implements HclResource
func (*Panel) GetDescription ¶ added in v0.7.1
GetDescription implements ModTreeItem
func (*Panel) GetMetadata ¶ added in v0.7.1
func (p *Panel) GetMetadata() *ResourceMetadata
GetMetadata implements ResourceWithMetadata
func (*Panel) GetParents ¶ added in v0.7.1
func (p *Panel) GetParents() []ModTreeItem
GetParents implements ModTreeItem
func (*Panel) InitialiseFromFile ¶ added in v0.7.1
func (p *Panel) InitialiseFromFile(modPath, filePath string) (MappableResource, []byte, error)
InitialiseFromFile implements MappableResource
func (*Panel) Name ¶ added in v0.7.1
Name implements HclResource return name in format: 'panel.<shortName>'
func (*Panel) OnDecoded ¶ added in v0.7.1
func (p *Panel) OnDecoded(*hcl.Block) hcl.Diagnostics
OnDecoded implements HclResource
func (*Panel) QualifiedName ¶ added in v0.7.1
QualifiedName returns the name in format: '<modName>.panel.<shortName>'
func (*Panel) SetMetadata ¶ added in v0.7.1
func (p *Panel) SetMetadata(metadata *ResourceMetadata)
SetMetadata implements ResourceWithMetadata
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 // contains filtered or unexported fields }
func NewParamDef ¶ added in v0.8.0
type ParsedPropertyPath ¶ added in v0.5.0
func ParseResourcePropertyPath ¶ added in v0.5.0
func ParseResourcePropertyPath(propertyPath string) (res *ParsedPropertyPath, err error)
type ParsedResourceName ¶ added in v0.5.0
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 *goVersion.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 PreparedStatementProvider ¶ added in v0.8.0
type PreparedStatementProvider interface { Name() string ModName() string GetParams() []*ParamDef GetPreparedStatementName() string }
PreparedStatementProvider must be implemented by resources which supports prepared statements, i.e. Control and Query
type Query ¶
type Query struct { ShortName string `cty:"short_name"` FullName string `cty:"name"` Description *string `cty:"description" column:"description,text"` Documentation *string `cty:"documentation" column:"documentation,text"` SearchPath *string `cty:"search_path"column:"search_path,text"` SearchPathPrefix *string `cty:"search_path_prefix" column:"search_path_prefix,text"` SQL *string `cty:"sql" hcl:"sql" column:"sql,text"` Tags *map[string]string `cty:"tags" hcl:"tags" column:"tags,jsonb"` Title *string `cty:"title" hcl:"title" column:"title,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 PreparedStatementName string `column:"prepared_statement_name,text"` // contains filtered or unexported fields }
Query is a struct representing the Query resource
func (*Query) AddReference ¶ added in v0.5.0
func (q *Query) AddReference(ref *ResourceReference)
AddReference implements HclResource
func (*Query) GetDeclRange ¶ added in v0.9.0
func (q *Query) GetDeclRange() *hcl.Range
GetDeclRange implements HclResource
func (*Query) GetMetadata ¶ added in v0.5.0
func (q *Query) GetMetadata() *ResourceMetadata
GetMetadata implements ResourceWithMetadata
func (*Query) GetPreparedStatementName ¶ added in v0.9.0
GetPreparedStatementName implements PreparedStatementProvider
func (*Query) InitialiseFromFile ¶
func (q *Query) InitialiseFromFile(modPath, filePath string) (MappableResource, []byte, error)
InitialiseFromFile implements MappableResource
func (*Query) OnDecoded ¶ added in v0.5.0
func (q *Query) OnDecoded(*hcl.Block) hcl.Diagnostics
OnDecoded implements HclResource
func (*Query) QualifiedName ¶ added in v0.5.0
QualifiedName returns the name in format: '<modName>.control.<shortName>'
func (*Query) SetMetadata ¶ added in v0.5.0
func (q *Query) SetMetadata(metadata *ResourceMetadata)
SetMetadata implements ResourceWithMetadata
type QueryArgs ¶ added in v0.8.0
type QueryArgs struct { Args 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) ResolveAsString ¶ added in v0.8.0
func (q *QueryArgs) ResolveAsString(source PreparedStatementProvider) (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)
type Report ¶ added in v0.7.1
type Report struct { FullName string `cty:"name"` ShortName string Title *string Reports []*Report //`hcl:"report,block"` Panels []*Panel //`hcl:"panel,block"` Mod *Mod `cty:"mod"` DeclRange hcl.Range // contains filtered or unexported fields }
Report is a struct representing the Report resource
func (*Report) AddChild ¶ added in v0.7.1
func (r *Report) AddChild(child ModTreeItem) error
AddChild implements ModTreeItem
func (*Report) AddParent ¶ added in v0.7.1
func (r *Report) AddParent(parent ModTreeItem) error
AddParent implements ModTreeItem
func (*Report) AddReference ¶ added in v0.7.1
func (r *Report) AddReference(*ResourceReference)
AddReference implements HclResource
func (*Report) Diff ¶ added in v0.7.1
func (r *Report) Diff(new *Report) *ReportTreeItemDiffs
func (*Report) GetChildren ¶ added in v0.7.1
func (r *Report) GetChildren() []ModTreeItem
GetChildren implements ModTreeItem
func (*Report) GetDeclRange ¶ added in v0.9.0
func (r *Report) GetDeclRange() *hcl.Range
GetDeclRange implements HclResource
func (*Report) GetDescription ¶ added in v0.7.1
GetDescription implements ModTreeItem
func (*Report) GetMetadata ¶ added in v0.7.1
func (r *Report) GetMetadata() *ResourceMetadata
GetMetadata implements ResourceWithMetadata
func (*Report) GetParents ¶ added in v0.7.1
func (r *Report) GetParents() []ModTreeItem
GetParents implements ModTreeItem
func (*Report) Name ¶ added in v0.7.1
Name implements HclResource, ModTreeItem return name in format: 'report.<shortName>'
func (*Report) OnDecoded ¶ added in v0.7.1
func (r *Report) OnDecoded(*hcl.Block) hcl.Diagnostics
OnDecoded implements HclResource
func (*Report) QualifiedName ¶ added in v0.7.1
QualifiedName returns the name in format: '<modName>.report.<shortName>'
func (*Report) SetMetadata ¶ added in v0.7.1
func (r *Report) SetMetadata(metadata *ResourceMetadata)
SetMetadata implements ResourceWithMetadata
type ReportTreeItemDiffs ¶ added in v0.7.1
type ReportTreeItemDiffs struct { Name string Item ModTreeItem ChangedProperties []string AddedItems []string RemovedItems []string }
ReportTreeItemDiffs is a struct representing the differences between 2 ReportTreeItems (of same type)
func (*ReportTreeItemDiffs) AddAddedItem ¶ added in v0.7.1
func (d *ReportTreeItemDiffs) AddAddedItem(name string)
func (*ReportTreeItemDiffs) AddPropertyDiff ¶ added in v0.7.1
func (d *ReportTreeItemDiffs) AddPropertyDiff(propertyName string)
func (*ReportTreeItemDiffs) AddRemovedItem ¶ added in v0.7.1
func (d *ReportTreeItemDiffs) AddRemovedItem(name string)
func (*ReportTreeItemDiffs) HasChanges ¶ added in v0.7.1
func (d *ReportTreeItemDiffs) HasChanges() bool
type Requires ¶ added in v0.5.0
type Requires struct { SteampipeVersionString string `hcl:"steampipe,optional"` SteampipeVersion *goVersion.Version Plugins []*PluginVersion `hcl:"plugin,block"` Mods []*ModVersion `hcl:"mod,block"` DeclRange hcl.Range `json:"-"` }
Requires is a struct representing mod dependencies
func (*Requires) Initialise ¶ added in v0.9.0
func (r *Requires) Initialise() hcl.Diagnostics
func (*Requires) ValidateSteampipeVersion ¶ added in v0.9.0
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 }
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 { 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"` // contains filtered or unexported fields }
func (*ResourceReference) Equals ¶ added in v0.9.0
func (r *ResourceReference) Equals(other *ResourceReference) bool
func (*ResourceReference) GetMetadata ¶ added in v0.9.0
func (r *ResourceReference) GetMetadata() *ResourceMetadata
GetMetadata implements ResourceWithMetadata
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) SetMetadata ¶ added in v0.9.0
func (r *ResourceReference) SetMetadata(metadata *ResourceMetadata)
SetMetadata implements ResourceWithMetadata
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) }
ResourceWithMetadata must be implenented by resources which supports reflection metadata
type Variable ¶ added in v0.8.0
type Variable struct { 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 // 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) *Variable
func (*Variable) AddReference ¶ added in v0.8.0
func (v *Variable) AddReference(*ResourceReference)
AddReference implements HclResource
func (*Variable) GetDeclRange ¶ added in v0.9.0
func (v *Variable) GetDeclRange() *hcl.Range
GetDeclRange implements HclResource
func (*Variable) GetMetadata ¶ added in v0.8.0
func (v *Variable) GetMetadata() *ResourceMetadata
GetMetadata implements ResourceWithMetadata
func (*Variable) OnDecoded ¶ added in v0.8.0
func (v *Variable) OnDecoded(*hcl.Block) hcl.Diagnostics
OnDecoded implements HclResource
func (*Variable) QualifiedName ¶ added in v0.9.0
QualifiedName returns the name in format: '<modName>.var.<shortName>'
func (*Variable) Required ¶ added in v0.8.0
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 (*Variable) SetMetadata ¶ added in v0.8.0
func (v *Variable) SetMetadata(metadata *ResourceMetadata)
SetMetadata implements ResourceWithMetadata
type VariableValidationFailedError ¶ added in v0.8.0
type VariableValidationFailedError struct { }
func (VariableValidationFailedError) Error ¶ added in v0.8.0
func (m VariableValidationFailedError) Error() string
type WorkspaceResourceMaps ¶ added in v0.5.0
type WorkspaceResourceMaps struct { Mods map[string]*Mod Queries map[string]*Query Controls map[string]*Control Benchmarks map[string]*Benchmark Variables map[string]*Variable References map[string]*ResourceReference }
WorkspaceResourceMaps is a struct containing maps of all mod resource types This is provided to avoid db needing to reference workspace package
func NewWorkspaceResourceMaps ¶ added in v0.8.0
func NewWorkspaceResourceMaps() *WorkspaceResourceMaps
func (*WorkspaceResourceMaps) AddPreparedStatementProvider ¶ added in v0.8.0
func (m *WorkspaceResourceMaps) AddPreparedStatementProvider(provider PreparedStatementProvider)
func (*WorkspaceResourceMaps) Equals ¶ added in v0.8.0
func (m *WorkspaceResourceMaps) Equals(other *WorkspaceResourceMaps) bool
func (*WorkspaceResourceMaps) PopulateReferences ¶ added in v0.9.0
func (m *WorkspaceResourceMaps) PopulateReferences()
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
func (r *WorkspaceResources) Merge(other *WorkspaceResources) *WorkspaceResources
Source Files ¶
- attributes.go
- benchmark.go
- connection.go
- control.go
- errors.go
- interfaces.go
- local.go
- mod.go
- mod_map.go
- mod_version.go
- nodepath.go
- open_graph.go
- panel.go
- param_def.go
- parse_names.go
- plugin_version.go
- prepared_statement.go
- query.go
- query_args.go
- report.go
- report_tree_item_diffs.go
- requires.go
- resource_metadata.go
- resource_reference.go
- resource_type_map.go
- variable.go
- workspace_resource_maps.go
- workspace_resources.go