resources

package
v1.1.0-alpha.202501031703 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const RuntimeDependencyDashboardScope = "self"

Variables

This section is empty.

Functions

func GenericTypeToBlockType

func GenericTypeToBlockType[T modconfig.ModTreeItem]() string

GenericTypeToBlockType converts a resource type generic param into a block type NOTE special case handling for dashboard items

func NewBenchmark

func NewBenchmark(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewControl

func NewControl(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboard

func NewDashboard(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardCard

func NewDashboardCard(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardCategory

func NewDashboardCategory(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardChart

func NewDashboardChart(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardContainer

func NewDashboardContainer(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardEdge

func NewDashboardEdge(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardFlow

func NewDashboardFlow(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardGraph

func NewDashboardGraph(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardHierarchy

func NewDashboardHierarchy(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardImage

func NewDashboardImage(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardInput

func NewDashboardInput(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardNode

func NewDashboardNode(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardTable

func NewDashboardTable(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardText

func NewDashboardText(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDashboardWith

func NewDashboardWith(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDetection

func NewDetection(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewDetectionBenchmark

func NewDetectionBenchmark(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewModResources

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

func NewQuery

func NewQuery(block *hcl.Block, mod *modconfig.Mod, shortName string) modconfig.HclResource

func NewRootBenchmarkWithChildren

func NewRootBenchmarkWithChildren(mod *modconfig.Mod, children []modconfig.ModTreeItem) modconfig.HclResource

func ResolveArgs

func ResolveArgs(qp QueryProvider, runtimeArgs *QueryArgs) ([]any, error)

ResolveArgs 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 query invocation (the arg values and param defaults will already have been converted to postgres format)

Types

type Benchmark

type Benchmark struct {
	modconfig.ResourceWithMetadataImpl
	modconfig.ModTreeItemImpl
	DashboardLeafNodeImpl

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

	// child names as NamedItem structs - used to allow setting children via the 'children' property
	ChildNames       modconfig.NamedItemList `cty:"child_names" json:"-"`
	ChildNameStrings []string                `cty:"child_name_strings" json:"children,omitempty"`

	// dashboard specific properties
	Inputs []*DashboardInput `cty:"inputs" json:"inputs,omitempty"`

	Base *Benchmark `hcl:"base" json:"-"`
}

Benchmark is a struct representing the Benchmark resource

func (*Benchmark) CtyValue

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

CtyValue implements CtyValueProvider

func (*Benchmark) Diff

func (b *Benchmark) Diff(other *Benchmark) *modconfig.ModTreeItemDiffs

func (*Benchmark) Equals

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

func (*Benchmark) GetChildControls

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

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

func (*Benchmark) GetListData

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

GetListData implements printers.Listable

func (*Benchmark) GetShowData

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

GetShowData implements printers.Showable

func (*Benchmark) OnDecoded

func (b *Benchmark) OnDecoded(block *hcl.Block, _ modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*Benchmark) SetBaseProperties

func (b *Benchmark) SetBaseProperties()

func (*Benchmark) String

func (b *Benchmark) String() string

func (*Benchmark) WalkResources

func (b *Benchmark) WalkResources(resourceFunc func(resource modconfig.ModTreeItem) (bool, error)) error

type Control

type Control struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl
	DashboardLeafNodeImpl

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

	Severity *string `cty:"severity" hcl:"severity"  snapshot:"severity" json:"severity,omitempty"`

	// dashboard specific properties
	Base *Control `hcl:"base" json:"-"`
	// contains filtered or unexported fields
}

Control is a struct representing the Control resource

func (*Control) CtyValue

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

CtyValue implements CtyValueProvider

func (*Control) Diff

func (c *Control) Diff(other *Control) *modconfig.ModTreeItemDiffs

func (*Control) Equals

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

func (*Control) GetParentNames

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

func (*Control) GetShowData

func (c *Control) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*Control) OnDecoded

func (c *Control) OnDecoded(block *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*Control) SetBaseProperties

func (c *Control) SetBaseProperties()

func (*Control) String

func (c *Control) String() string

type Dashboard

type Dashboard struct {
	modconfig.ResourceWithMetadataImpl
	modconfig.ModTreeItemImpl
	WithProviderImpl
	DashboardLeafNodeImpl

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

	Inputs  []*DashboardInput `cty:"inputs" json:"inputs,omitempty"`
	UrlPath string            `cty:"url_path"  json:"url_path,omitempty"`
	Base    *Dashboard        `hcl:"base" json:"-"`
	// store children in a way which can be serialised via cty
	ChildNames []string `cty:"children" json:"children,omitempty"`
	// contains filtered or unexported fields
}

Dashboard is a struct representing the Dashboard resource

func NewQueryDashboard

func NewQueryDashboard(qp QueryProvider) (*Dashboard, error)

NewQueryDashboard creates a dashboard to wrap a query/control this is used for snapshot generation

func (*Dashboard) AddChild

func (d *Dashboard) AddChild(child modconfig.ModTreeItem) hcl.Diagnostics

func (*Dashboard) CtyValue

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

CtyValue implements CtyValueProvider

func (*Dashboard) Diff

func (d *Dashboard) Diff(other *Dashboard) *modconfig.ModTreeItemDiffs

func (*Dashboard) Equals

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

func (*Dashboard) GetInput

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

func (*Dashboard) GetInputs

func (d *Dashboard) GetInputs() map[string]*DashboardInput

func (*Dashboard) InitInputs

func (d *Dashboard) InitInputs() hcl.Diagnostics

func (*Dashboard) OnDecoded

func (d *Dashboard) OnDecoded(block *hcl.Block, _ modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*Dashboard) SetBaseProperties

func (d *Dashboard) SetBaseProperties() hcl.Diagnostics

func (*Dashboard) ValidateRuntimeDependencies

func (d *Dashboard) ValidateRuntimeDependencies(workspace modconfig.ModResourcesProvider) error

func (*Dashboard) WalkResources

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

type DashboardCard

type DashboardCard struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl
	DashboardLeafNodeImpl

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

	Label *string `cty:"label" hcl:"label" snapshot:"label" json:"label,omitempty"`
	Value *string `cty:"value" hcl:"value" snapshot:"value" json:"value,omitempty"`
	Icon  *string `cty:"icon" hcl:"icon" snapshot:"icon" json:"icon,omitempty"`
	HREF  *string `cty:"href" hcl:"href" snapshot:"href" json:"href,omitempty"`

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

DashboardCard is a struct representing a leaf dashboard node

func (*DashboardCard) CtyValue

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

CtyValue implements CtyValueProvider

func (*DashboardCard) Diff

func (*DashboardCard) Equals

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

func (*DashboardCard) GetDocumentation

func (c *DashboardCard) GetDocumentation() string

GetDocumentation implements ModTreeItem

func (*DashboardCard) GetShowData

func (c *DashboardCard) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*DashboardCard) OnDecoded

func (c *DashboardCard) OnDecoded(block *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardCard) SetBaseProperties

func (c *DashboardCard) SetBaseProperties()

func (*DashboardCard) ValidateQuery

func (c *DashboardCard) ValidateQuery() hcl.Diagnostics

ValidateQuery implements QueryProvider

type DashboardCategory

type DashboardCategory struct {
	modconfig.ResourceWithMetadataImpl
	modconfig.ModTreeItemImpl

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

	// TACTICAL: include a title property (with a different name to the property in HclResourceImpl  for clarity)
	// This is purely to ensure the title is included in the panel properties of snapshots
	// Note: this will be parsed from HCL, but we must set this explicitly in SetBaseProperties if there is a base
	CategoryTitle *string                               `cty:"title" hcl:"title" snapshot:"title" json:"-"`
	CategoryName  string                                `snapshot:"name" json:"-"`
	Color         *string                               `cty:"color" hcl:"color" snapshot:"color" json:"color,omitempty"`
	Depth         *int                                  `cty:"depth" hcl:"depth" snapshot:"depth" json:"depth,omitempty"`
	Icon          *string                               `cty:"icon" hcl:"icon" snapshot:"icon" json:"icon,omitempty"`
	HREF          *string                               `cty:"href" hcl:"href" snapshot:"href" json:"href,omitempty"`
	Fold          *DashboardCategoryFold                `cty:"fold" hcl:"fold,block" snapshot:"fold" json:"fold,omitempty"`
	PropertyList  DashboardCategoryPropertyList         `cty:"property_list" hcl:"property,block" json:"-"`
	Properties    map[string]*DashboardCategoryProperty `cty:"properties" snapshot:"properties" json:"properties,omitempty"`
	PropertyOrder []string                              `cty:"property_order" hcl:"property_order,optional" snapshot:"property_order" json:"property_order,omitempty"`
	Base          *DashboardCategory                    `hcl:"base" json:"base,omitempty"`
}

func (*DashboardCategory) CtyValue

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

CtyValue implements CtyValueProvider

func (*DashboardCategory) Diff

func (*DashboardCategory) Equals

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

func (*DashboardCategory) OnDecoded

func (c *DashboardCategory) OnDecoded(block *hcl.Block, _ modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardCategory) SetBaseProperties

func (c *DashboardCategory) SetBaseProperties()

type DashboardCategoryFold

type DashboardCategoryFold struct {
	Title     *string `cty:"title" hcl:"title" snapshot:"title" json:"title,omitempty"`
	Threshold *int    `cty:"threshold" hcl:"threshold" snapshot:"threshold" json:"threshold,omitempty"`
	Icon      *string `cty:"icon" hcl:"icon" snapshot:"icon" json:"icon,omitempty"`
}

func (DashboardCategoryFold) Equals

type DashboardCategoryList

type DashboardCategoryList []*DashboardCategory

func (*DashboardCategoryList) Merge

type DashboardCategoryProperty

type DashboardCategoryProperty struct {
	ShortName string  `hcl:"name,label" snapshot:"name" json:"name"`
	Display   *string `cty:"display" hcl:"display" snapshot:"display" json:"display,omitempty"`
	Wrap      *string `cty:"wrap" hcl:"wrap" snapshot:"wrap" json:"wrap,omitempty"`
	HREF      *string `cty:"href" hcl:"href" snapshot:"href" json:"href,omitempty"`
}

func (DashboardCategoryProperty) Equals

type DashboardCategoryPropertyList

type DashboardCategoryPropertyList []*DashboardCategoryProperty

func (*DashboardCategoryPropertyList) Merge

type DashboardChart

type DashboardChart struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl
	DashboardLeafNodeImpl

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

	Legend     *DashboardChartLegend            `cty:"legend" hcl:"legend,block" snapshot:"legend" json:"legend,omitempty"`
	SeriesList DashboardChartSeriesList         `cty:"series_list" hcl:"series,block" json:"series,omitempty"`
	Axes       *DashboardChartAxes              `cty:"axes" hcl:"axes,block" snapshot:"axes" json:"axes,omitempty"`
	Grouping   *string                          `cty:"grouping" hcl:"grouping" snapshot:"grouping" json:"grouping,omitempty"`
	Transform  *string                          `cty:"transform" hcl:"transform" snapshot:"transform" json:"transform,omitempty"`
	Series     map[string]*DashboardChartSeries `cty:"series" snapshot:"series"`
	Base       *DashboardChart                  `hcl:"base" json:"-"`
}

DashboardChart is a struct representing a leaf dashboard node

func (*DashboardChart) CtyValue

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

CtyValue implements CtyValueProvider

func (*DashboardChart) Diff

func (*DashboardChart) Equals

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

func (*DashboardChart) GetShowData

func (c *DashboardChart) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*DashboardChart) OnDecoded

func (c *DashboardChart) OnDecoded(block *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardChart) SetBaseProperties

func (c *DashboardChart) SetBaseProperties()

type DashboardChartAxes

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

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

func (*DashboardChartAxes) Merge

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

type DashboardChartAxesX

type DashboardChartAxesX 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 (*DashboardChartAxesX) Equals

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

func (*DashboardChartAxesX) Merge

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

type DashboardChartAxesY

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

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

func (*DashboardChartAxesY) Merge

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

type DashboardChartAxisTitle

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

func (*DashboardChartAxisTitle) Merge

type DashboardChartLabels

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

func (*DashboardChartLabels) Equals

func (*DashboardChartLabels) Merge

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

type DashboardChartLegend

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

func (*DashboardChartLegend) Equals

func (*DashboardChartLegend) Merge

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

type DashboardChartSeries

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     map[string]*DashboardChartSeriesPoint `cty:"points" json:"points,omitempty"`
	PointsList []*DashboardChartSeriesPoint          `hcl:"point,block" json:"-"`
}

func (*DashboardChartSeries) Equals

func (*DashboardChartSeries) OnDecoded

func (s *DashboardChartSeries) OnDecoded()

type DashboardChartSeriesList

type DashboardChartSeriesList []*DashboardChartSeries

func (*DashboardChartSeriesList) Merge

type DashboardChartSeriesPoint

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

func (DashboardChartSeriesPoint) Equals

type DashboardContainer

type DashboardContainer struct {
	modconfig.ResourceWithMetadataImpl
	modconfig.ModTreeItemImpl
	DashboardLeafNodeImpl

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

	Inputs []*DashboardInput `cty:"inputs" json:"inputs,omitempty"`
	// store children in a way which can be serialised via cty
	ChildNames []string `cty:"children" json:"children,omitempty"`
}

DashboardContainer is a struct representing the Dashboard and Container resource

func (*DashboardContainer) CtyValue

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

CtyValue implements CtyValueProvider

func (*DashboardContainer) Diff

func (*DashboardContainer) Equals

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

func (*DashboardContainer) GetShowData

func (c *DashboardContainer) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*DashboardContainer) OnDecoded

func (c *DashboardContainer) OnDecoded(block *hcl.Block, _ modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardContainer) WalkResources

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

type DashboardEdge

type DashboardEdge struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl
	DashboardLeafNodeImpl

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

	Category *DashboardCategory `cty:"category" hcl:"category" snapshot:"category" json:"category,omitempty"`
	Base     *DashboardEdge     `hcl:"base" json:"-"`
}

DashboardEdge is a struct representing a leaf dashboard node

func (*DashboardEdge) CtyValue

func (e *DashboardEdge) CtyValue() (cty.Value, error)

CtyValue implements CtyValueProvider

func (*DashboardEdge) Diff

func (*DashboardEdge) Equals

func (e *DashboardEdge) Equals(other *DashboardEdge) bool

func (*DashboardEdge) GetDocumentation

func (e *DashboardEdge) GetDocumentation() string

GetDocumentation implements DashboardLeafNode

func (*DashboardEdge) OnDecoded

func (e *DashboardEdge) OnDecoded(_ *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardEdge) SetBaseProperties

func (e *DashboardEdge) SetBaseProperties()

type DashboardEdgeList

type DashboardEdgeList []*DashboardEdge

func (*DashboardEdgeList) Contains

func (l *DashboardEdgeList) Contains(other *DashboardEdge) bool

func (*DashboardEdgeList) Get

func (l *DashboardEdgeList) Get(name string) *DashboardEdge

func (*DashboardEdgeList) Merge

func (l *DashboardEdgeList) Merge(other DashboardEdgeList)

func (*DashboardEdgeList) Names

func (l *DashboardEdgeList) Names() []string

type DashboardFlow

type DashboardFlow struct {
	modconfig.ResourceWithMetadataImpl
	DashboardLeafNodeImpl
	// NOTE: we must have cty tag on at least one property otherwise gohcl.DecodeExpression panics
	NodeAndEdgeProviderImpl `cty:"node_and_edge_provider"`

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

	Base *DashboardFlow `hcl:"base" json:"-"`
}

DashboardFlow is a struct representing a leaf dashboard node

func (*DashboardFlow) CtyValue

func (f *DashboardFlow) CtyValue() (cty.Value, error)

CtyValue implements CtyValueProvider

func (*DashboardFlow) Diff

func (*DashboardFlow) Equals

func (f *DashboardFlow) Equals(other *DashboardFlow) bool

func (*DashboardFlow) GetChildren

func (f *DashboardFlow) GetChildren() []modconfig.ModTreeItem

TODO [node_reuse] Add DashboardLeafNodeImpl and move this there https://github.com/turbot/steampipe/issues/2926 GetChildren implements ModTreeItem

func (*DashboardFlow) GetShowData

func (f *DashboardFlow) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*DashboardFlow) OnDecoded

func (f *DashboardFlow) OnDecoded(block *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardFlow) SetBaseProperties

func (f *DashboardFlow) SetBaseProperties()

func (*DashboardFlow) ValidateQuery

func (*DashboardFlow) ValidateQuery() hcl.Diagnostics

ValidateQuery implements QueryProvider

type DashboardGraph

type DashboardGraph struct {
	modconfig.ResourceWithMetadataImpl
	DashboardLeafNodeImpl
	// NOTE: we must have cty tag on at least one property otherwise gohcl.DecodeExpression panics
	NodeAndEdgeProviderImpl `cty:"node_and_edge_provider"`

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

	Direction *string `cty:"direction" hcl:"direction" json:"direction,omitempty" snapshot:"direction"`

	Base *DashboardGraph `hcl:"base" json:"-"`
}

DashboardGraph is a struct representing a leaf dashboard node

func (*DashboardGraph) CtyValue

func (g *DashboardGraph) CtyValue() (cty.Value, error)

CtyValue implements CtyValueProvider

func (*DashboardGraph) Diff

func (*DashboardGraph) Equals

func (g *DashboardGraph) Equals(other *DashboardGraph) bool

func (*DashboardGraph) GetChildren

func (g *DashboardGraph) GetChildren() []modconfig.ModTreeItem

GetChildren implements ModTreeItem

func (*DashboardGraph) GetShowData

func (g *DashboardGraph) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*DashboardGraph) OnDecoded

func (g *DashboardGraph) OnDecoded(block *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardGraph) SetBaseProperties

func (g *DashboardGraph) SetBaseProperties()

type DashboardHierarchy

type DashboardHierarchy struct {
	modconfig.ResourceWithMetadataImpl
	DashboardLeafNodeImpl
	// NOTE: we must have cty tag on at least one property otherwise gohcl.DecodeExpression panics
	NodeAndEdgeProviderImpl `cty:"node_and_edge_provider"`

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

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

DashboardHierarchy is a struct representing a leaf dashboard node

func (*DashboardHierarchy) CtyValue

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

CtyValue implements CtyValueProvider

func (*DashboardHierarchy) Diff

func (*DashboardHierarchy) Equals

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

func (*DashboardHierarchy) GetChildren

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

GetChildren implements ModTreeItem

func (*DashboardHierarchy) GetDocumentation

func (h *DashboardHierarchy) GetDocumentation() string

GetDocumentation implements ModTreeItem

func (*DashboardHierarchy) GetShowData

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

GetShowData implements printers.Showable

func (*DashboardHierarchy) OnDecoded

func (h *DashboardHierarchy) OnDecoded(block *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardHierarchy) SetBaseProperties

func (h *DashboardHierarchy) SetBaseProperties()

type DashboardImage

type DashboardImage struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl
	DashboardLeafNodeImpl

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

	Src *string `cty:"src" hcl:"src"  json:"src,omitempty" snapshot:"src"`
	Alt *string `cty:"alt" hcl:"alt"  json:"alt,omitempty" snapshot:"alt"`

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

DashboardImage is a struct representing a leaf dashboard node

func (*DashboardImage) CtyValue

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

CtyValue implements CtyValueProvider

func (*DashboardImage) Diff

func (*DashboardImage) Equals

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

func (*DashboardImage) GetDocumentation

func (*DashboardImage) GetDocumentation() string

GetDocumentation implements ModTreeItem

func (*DashboardImage) GetShowData

func (i *DashboardImage) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*DashboardImage) GetType

func (*DashboardImage) GetType() string

GetType implements DashboardLeafNode

func (*DashboardImage) OnDecoded

func (i *DashboardImage) OnDecoded(block *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardImage) SetBaseProperties

func (i *DashboardImage) SetBaseProperties()

func (*DashboardImage) ValidateQuery

func (i *DashboardImage) ValidateQuery() hcl.Diagnostics

ValidateQuery implements QueryProvider

type DashboardInput

type DashboardInput struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl
	DashboardLeafNodeImpl

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

	DashboardName string                  `json:"dashboard,omitempty"`
	Label         *string                 `cty:"label" hcl:"label" json:"label,omitempty" snapshot:"label"`
	Placeholder   *string                 `cty:"placeholder" hcl:"placeholder" json:"placeholder,omitempty" snapshot:"placeholder"`
	Options       []*DashboardInputOption `cty:"options" hcl:"option,block" json:"options,omitempty" snapshot:"options"`
	// tactical - exists purely so we can put "unqualified_name" in the snbapshot panel for the input
	// TODO remove when input names are refactored https://github.com/turbot/steampipe/issues/2863
	InputName string `cty:"input_name" json:"unqualified_name" snapshot:"unqualified_name"`

	Base *DashboardInput `hcl:"base" json:"-"`
	// contains filtered or unexported fields
}

DashboardInput is a struct representing a leaf dashboard node

func (*DashboardInput) Clone

func (i *DashboardInput) Clone() *DashboardInput

TODO remove https://github.com/turbot/steampipe/issues/2864

func (*DashboardInput) CtyValue

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

CtyValue implements CtyValueProvider

func (*DashboardInput) DependsOnInput

func (i *DashboardInput) DependsOnInput(changedInputName string) bool

DependsOnInput returns whether this input has a runtime dependency on the given input¬

func (*DashboardInput) Diff

func (*DashboardInput) Equals

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

func (*DashboardInput) GetShowData

func (i *DashboardInput) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*DashboardInput) OnDecoded

func (i *DashboardInput) OnDecoded(block *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardInput) SetBaseProperties

func (i *DashboardInput) SetBaseProperties()

func (*DashboardInput) SetDashboard

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

SetDashboard sets the parent dashboard container

func (*DashboardInput) ValidateQuery

func (i *DashboardInput) ValidateQuery() hcl.Diagnostics

ValidateQuery implements QueryProvider

type DashboardInputOption

type DashboardInputOption struct {
	Name  string  `hcl:"name,label" json:"name" snapshot:"name"`
	Label *string `cty:"label" hcl:"label" json:"label,omitempty" snapshot:"label"`
}

DashboardInputOption is a struct representing dashboard input option

func (DashboardInputOption) Equals

type DashboardLeafNode

type DashboardLeafNode interface {
	modconfig.ModTreeItem
	modconfig.ResourceWithMetadata
	GetDisplay() string
	GetType() string
	GetWidth() int
}

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

type DashboardLeafNodeImpl

type DashboardLeafNodeImpl struct {
	DashboardLeafNodeRemain hcl.Body `hcl:",remain" json:"-"`
	Width                   *int     `cty:"width" hcl:"width"  json:"width,omitempty"`
	Type                    *string  `cty:"type" hcl:"type"  json:"type,omitempty"`
	Display                 *string  `cty:"display" hcl:"display" json:"display,omitempty" snapshot:"display"`
}

func (*DashboardLeafNodeImpl) GetDisplay

func (d *DashboardLeafNodeImpl) GetDisplay() string

func (*DashboardLeafNodeImpl) GetType

func (d *DashboardLeafNodeImpl) GetType() string

func (*DashboardLeafNodeImpl) GetWidth

func (d *DashboardLeafNodeImpl) GetWidth() int

type DashboardNode

type DashboardNode struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl
	DashboardLeafNodeImpl

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

	Category *DashboardCategory `cty:"category" hcl:"category" json:"category,omitempty" snapshot:"category"`
	Base     *DashboardNode     `hcl:"base" json:"-"`
}

DashboardNode is a struct representing a leaf dashboard node

func (*DashboardNode) CtyValue

func (n *DashboardNode) CtyValue() (cty.Value, error)

CtyValue implements CtyValueProvider

func (*DashboardNode) Diff

func (*DashboardNode) Equals

func (n *DashboardNode) Equals(other *DashboardNode) bool

func (*DashboardNode) OnDecoded

func (n *DashboardNode) OnDecoded(_ *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource—

func (*DashboardNode) SetBaseProperties

func (n *DashboardNode) SetBaseProperties()

type DashboardNodeList

type DashboardNodeList []*DashboardNode

func (*DashboardNodeList) Contains

func (l *DashboardNodeList) Contains(other *DashboardNode) bool

func (*DashboardNodeList) Get

func (l *DashboardNodeList) Get(name string) *DashboardNode

func (*DashboardNodeList) Merge

func (l *DashboardNodeList) Merge(other DashboardNodeList)

func (*DashboardNodeList) Names

func (l *DashboardNodeList) Names() []string

type DashboardTable

type DashboardTable struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl
	DashboardLeafNodeImpl

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

	ColumnList DashboardTableColumnList         `cty:"column_list" hcl:"column,block" json:"columns,omitempty"`
	Columns    map[string]*DashboardTableColumn `cty:"columns" snapshot:"columns"`
	Base       *DashboardTable                  `hcl:"base" json:"-"`
}

DashboardTable is a struct representing a leaf dashboard node

func NewQueryDashboardTable

func NewQueryDashboardTable(qp QueryProvider) (*DashboardTable, error)

NewQueryDashboardTable creates a Table to wrap a query. This is used in order to execute queries as dashboards

func (*DashboardTable) CtyValue

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

CtyValue implements CtyValueProvider

func (*DashboardTable) Diff

func (*DashboardTable) Equals

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

func (*DashboardTable) GetDocumentation

func (*DashboardTable) GetDocumentation() string

GetDocumentation implements ModTreeItem

func (*DashboardTable) GetShowData

func (t *DashboardTable) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*DashboardTable) OnDecoded

func (t *DashboardTable) OnDecoded(block *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardTable) SetBaseProperties

func (t *DashboardTable) SetBaseProperties()

type DashboardTableColumn

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

func (DashboardTableColumn) Equals

type DashboardTableColumnList

type DashboardTableColumnList []*DashboardTableColumn

func (*DashboardTableColumnList) Merge

type DashboardText

type DashboardText struct {
	modconfig.ResourceWithMetadataImpl
	modconfig.ModTreeItemImpl
	DashboardLeafNodeImpl

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

	Value *string `cty:"value" hcl:"value" snapshot:"value"  json:"value,omitempty"`

	Base *DashboardText `hcl:"base" json:"-"`
	Mod  *modconfig.Mod `cty:"mod" json:"-"`
}

DashboardText is a struct representing a leaf dashboard node

func (*DashboardText) CtyValue

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

CtyValue implements CtyValueProvider

func (*DashboardText) Diff

func (*DashboardText) Equals

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

func (*DashboardText) GetDocumentation

func (*DashboardText) GetDocumentation() string

GetDocumentation implements ModTreeItem

func (*DashboardText) GetShowData

func (t *DashboardText) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*DashboardText) OnDecoded

func (t *DashboardText) OnDecoded(*hcl.Block, modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DashboardText) SetBaseProperties

func (t *DashboardText) SetBaseProperties()

type DashboardWith

type DashboardWith struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl
	DashboardLeafNodeImpl

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

DashboardWith is a struct representing a leaf dashboard node

func (*DashboardWith) CtyValue

func (w *DashboardWith) CtyValue() (cty.Value, error)

CtyValue implements CtyValueProvider

func (*DashboardWith) Diff

func (*DashboardWith) Equals

func (w *DashboardWith) Equals(other *DashboardWith) bool

func (*DashboardWith) OnDecoded

func (w *DashboardWith) OnDecoded(_ *hcl.Block, _ modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

type Detection

type Detection struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl
	DashboardLeafNodeImpl

	// required to allow partial decoding
	Remain         hcl.Body `hcl:",remain" json:"-"`
	Severity       *string  `cty:"severity" hcl:"severity"  snapshot:"severity" json:"severity,omitempty"`
	DisplayColumns []string `cty:"display_columns" hcl:"display_columns,optional" snapshot:"display_columns" json:"display_columns,omitempty"`

	Base *Detection `hcl:"base" json:"-"`
}

Detection is a struct representing a leaf dashboard node

func (*Detection) CtyValue

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

CtyValue implements CtyValueProvider

func (*Detection) Diff

func (t *Detection) Diff(other *Detection) *modconfig.ModTreeItemDiffs

func (*Detection) Equals

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

func (*Detection) GetShowData

func (t *Detection) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*Detection) OnDecoded

func (t *Detection) OnDecoded(block *hcl.Block, resourceMapProvider modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*Detection) SetBaseProperties

func (t *Detection) SetBaseProperties()

type DetectionBenchmark

type DetectionBenchmark struct {
	modconfig.ResourceWithMetadataImpl
	modconfig.ModTreeItemImpl
	DashboardLeafNodeImpl

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

	// store children in a way which can be serialised via cty
	ChildNames       modconfig.NamedItemList `cty:"child_names" json:"-"`
	ChildNameStrings []string                `cty:"child_name_strings" json:"children,omitempty"`

	// dashboard specific properties
	Inputs []*DashboardInput   `cty:"inputs" json:"inputs,omitempty"`
	Base   *DetectionBenchmark `hcl:"base" json:"-"`
}

func NewWrapperDetectionBenchmark

func NewWrapperDetectionBenchmark(detection *Detection) *DetectionBenchmark

NewWrapperDetectionBenchmark creates a new DetectionBenchmark to wrap a detection which we wish to execute

func (*DetectionBenchmark) CtyValue

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

CtyValue implements CtyValueProvider

func (*DetectionBenchmark) Diff

func (*DetectionBenchmark) Equals

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

func (*DetectionBenchmark) GetListData

func (d *DetectionBenchmark) GetListData() *printers.RowData

GetListData implements printers.Listable

func (*DetectionBenchmark) GetShowData

func (d *DetectionBenchmark) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*DetectionBenchmark) OnDecoded

func (d *DetectionBenchmark) OnDecoded(block *hcl.Block, _ modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*DetectionBenchmark) SetBaseProperties

func (d *DetectionBenchmark) SetBaseProperties()

func (*DetectionBenchmark) WalkResources

func (d *DetectionBenchmark) WalkResources(resourceFunc func(resource modconfig.HclResource) (bool, error)) error

type NodeAndEdgeProvider

type NodeAndEdgeProvider interface {
	QueryProvider
	WithProvider
	GetEdges() DashboardEdgeList
	SetEdges(DashboardEdgeList)
	GetNodes() DashboardNodeList
	SetNodes(DashboardNodeList)
	AddCategory(category *DashboardCategory) hcl.Diagnostics
	AddChild(child modconfig.HclResource) hcl.Diagnostics
}

NodeAndEdgeProvider must be implemented by any dashboard leaf node which supports edges and nodes (DashboardGraph, DashboardFlow, DashboardHierarchy) TODO [node_reuse] add NodeAndEdgeProviderImpl https://github.com/turbot/steampipe/issues/2918

type NodeAndEdgeProviderImpl

type NodeAndEdgeProviderImpl struct {
	WithProviderImpl
	QueryProviderImpl

	NodeEdgeProviderRemain hcl.Body          `hcl:",remain" json:"-"`
	Nodes                  DashboardNodeList `cty:"node_list"  json:"nodes,omitempty"`
	Edges                  DashboardEdgeList `cty:"edge_list" json:"edges,omitempty"`
	NodeNames              []string          `json:"-" snapshot:"nodes"`
	EdgeNames              []string          `json:"-" snapshot:"edges"`

	Categories map[string]*DashboardCategory `cty:"categories" json:"categories" snapshot:"categories"`
}

func NewNodeAndEdgeProviderImpl

func NewNodeAndEdgeProviderImpl(block *hcl.Block, mod *modconfig.Mod, name string) NodeAndEdgeProviderImpl

func (*NodeAndEdgeProviderImpl) AddCategory

func (f *NodeAndEdgeProviderImpl) AddCategory(category *DashboardCategory) hcl.Diagnostics

AddCategory implements NodeAndEdgeProvider

func (*NodeAndEdgeProviderImpl) AddChild

func (f *NodeAndEdgeProviderImpl) AddChild(child modconfig.HclResource) hcl.Diagnostics

AddChild implements NodeAndEdgeProvider

func (*NodeAndEdgeProviderImpl) GetEdges

GetEdges implements NodeAndEdgeProvider

func (*NodeAndEdgeProviderImpl) GetNodes

GetNodes implements NodeAndEdgeProvider

func (*NodeAndEdgeProviderImpl) SetEdges

func (f *NodeAndEdgeProviderImpl) SetEdges(edges DashboardEdgeList)

SetEdges implements NodeAndEdgeProvider

func (*NodeAndEdgeProviderImpl) SetNodes

func (f *NodeAndEdgeProviderImpl) SetNodes(nodes DashboardNodeList)

SetNodes implements NodeAndEdgeProvider

type PowerpipeModResources

type PowerpipeModResources struct {
	// the parent mod
	Mod *modconfig.Mod

	Benchmarks            map[string]*Benchmark
	Controls              map[string]*Control
	Dashboards            map[string]*Dashboard
	DashboardCategories   map[string]*DashboardCategory
	DashboardCards        map[string]*DashboardCard
	DashboardCharts       map[string]*DashboardChart
	DashboardContainers   map[string]*DashboardContainer
	DashboardEdges        map[string]*DashboardEdge
	DashboardFlows        map[string]*DashboardFlow
	DashboardGraphs       map[string]*DashboardGraph
	DashboardHierarchies  map[string]*DashboardHierarchy
	DashboardImages       map[string]*DashboardImage
	DashboardInputs       map[string]map[string]*DashboardInput
	DashboardTables       map[string]*DashboardTable
	Detections            map[string]*Detection
	DetectionBenchmarks   map[string]*DetectionBenchmark
	DashboardTexts        map[string]*DashboardText
	DashboardNodes        map[string]*DashboardNode
	GlobalDashboardInputs map[string]*DashboardInput
	Locals                map[string]*modconfig.Local
	Variables             map[string]*modconfig.Variable
	// all mods (including deps)
	Mods       map[string]*modconfig.Mod
	Queries    map[string]*Query
	References map[string]*modconfig.ResourceReference
	// map of snapshot paths, keyed by snapshot name
	Snapshots map[string]string
}

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

func GetModResources

func GetModResources(mod *modconfig.Mod) *PowerpipeModResources

func (*PowerpipeModResources) AddMaps

func (m *PowerpipeModResources) AddMaps(sourceMaps ...modconfig.ModResources)

func (*PowerpipeModResources) AddReference

func (m *PowerpipeModResources) AddReference(ref *modconfig.ResourceReference)

func (*PowerpipeModResources) AddResource

func (m *PowerpipeModResources) AddResource(item modconfig.HclResource) hcl.Diagnostics

func (*PowerpipeModResources) AddSnapshots

func (m *PowerpipeModResources) AddSnapshots(snapshotPaths []string)

func (*PowerpipeModResources) Empty

func (m *PowerpipeModResources) Empty() bool

func (*PowerpipeModResources) Equals

func (*PowerpipeModResources) GetMods

func (m *PowerpipeModResources) GetMods() map[string]*modconfig.Mod

func (*PowerpipeModResources) GetReferences

func (m *PowerpipeModResources) GetReferences() map[string]*modconfig.ResourceReference

func (*PowerpipeModResources) GetResource

func (m *PowerpipeModResources) GetResource(parsedName *modconfig.ParsedResourceName) (resource modconfig.HclResource, found bool)

GetResource tries to find a resource with the given name in the PowerpipeModResources NOTE: this does NOT support inputs, which are NOT uniquely named in a mod

func (*PowerpipeModResources) GetVariables

func (m *PowerpipeModResources) GetVariables() map[string]*modconfig.Variable

func (*PowerpipeModResources) QueryProviders

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

QueryProviders returns a slice of all QueryProviders

func (*PowerpipeModResources) TopLevelResources

func (m *PowerpipeModResources) TopLevelResources() modconfig.ModResources

TopLevelResources returns a new PowerpipeModResources containing only top level resources (i.e. no dependencies)

func (*PowerpipeModResources) WalkResources

func (m *PowerpipeModResources) WalkResources(resourceFunc func(item modconfig.HclResource) (bool, error)) error

WalkResources calls resourceFunc for every resource in the mod if any resourceFunc returns false or an error, return immediately

type Query

type Query struct {
	modconfig.ResourceWithMetadataImpl
	QueryProviderImpl

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

	// only here as otherwise gocty.ImpliedType panics
	Unused string `cty:"unused" json:"-"`
}

Query is a struct representing the Query resource

func (*Query) CtyValue

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

CtyValue implements CtyValueProvider

func (*Query) Diff

func (q *Query) Diff(other *Query) *modconfig.ModTreeItemDiffs

func (*Query) Equals

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

func (*Query) OnDecoded

func (q *Query) OnDecoded(*hcl.Block, modconfig.ModResourcesProvider) hcl.Diagnostics

OnDecoded implements HclResource

func (*Query) String

func (q *Query) String() string

type QueryArgs

type QueryArgs struct {
	// NOTE: ArgMap and ArgList should not be set directly, but should be set using the
	// SetNamedArgVal and SetPositionalArgVal methods
	// This is so that stringNamedArgs and stringPositionalArgs can be set correctly
	ArgMap map[string]string `cty:"args" json:"args,omitempty"`
	// args list may be sparsely populated (in case of runtime dependencies)
	// so use *string
	ArgList    []*string                      `cty:"args_list" json:"args_list,omitempty"`
	References []*modconfig.ResourceReference `cty:"refs" json:"refs,omitempty"`
	// contains filtered or unexported fields
}

QueryArgs is a struct which contains the arguments used to invoke a query 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 MergeArgs

func MergeArgs(queryProvider QueryProvider, runtimeArgs *QueryArgs) (*QueryArgs, error)

MergeArgs ensures base and runtime args are non nil and merges them into single args

func NewQueryArgs

func NewQueryArgs() *QueryArgs

func (*QueryArgs) AddPositionalArgVal

func (q *QueryArgs) AddPositionalArgVal(value any) error

func (*QueryArgs) ArgsStringList

func (q *QueryArgs) ArgsStringList() []string

ArgsStringList convert ArgLists into list of strings

func (*QueryArgs) ConvertArgsList

func (q *QueryArgs) ConvertArgsList() ([]any, error)

ConvertArgsList convert ArgList into list of interface{} by unmarshalling

func (*QueryArgs) Empty

func (q *QueryArgs) Empty() bool

func (*QueryArgs) Equals

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

func (*QueryArgs) GetNamedArg

func (q *QueryArgs) GetNamedArg(name string) (interface{}, bool, error)

func (*QueryArgs) GetPositionalArg

func (q *QueryArgs) GetPositionalArg(idx int) (interface{}, bool, error)

func (*QueryArgs) GetShowData

func (q *QueryArgs) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*QueryArgs) Merge

func (q *QueryArgs) Merge(other *QueryArgs, source QueryProvider) (*QueryArgs, error)

Merge merges the other args with ourselves, creating and returning a new QueryArgs with the result NOTE: other has precedence

func (*QueryArgs) SetArgList

func (q *QueryArgs) SetArgList(argList []any) error

func (*QueryArgs) SetArgMap

func (q *QueryArgs) SetArgMap(argMap map[string]any) error

func (*QueryArgs) SetNamedArgVal

func (q *QueryArgs) SetNamedArgVal(name string, value any) (err error)

func (*QueryArgs) SetPositionalArgVal

func (q *QueryArgs) SetPositionalArgVal(value any, idx int) (err error)

SetPositionalArgVal sets the value of a positional arg NOTE: we add by index so we can populate stringPositionalArgs if needed

func (*QueryArgs) String

func (q *QueryArgs) String() string

func (*QueryArgs) ToString

func (q *QueryArgs) ToString(value any) (string, error)

func (*QueryArgs) Validate

func (q *QueryArgs) Validate() error

type QueryProvider

type QueryProvider interface {
	RuntimeDependencyProvider
	GetArgs() *QueryArgs
	GetParams() []*modconfig.ParamDef
	GetSQL() *string
	GetQuery() *Query
	SetArgs(*QueryArgs)
	SetParams([]*modconfig.ParamDef)
	GetResolvedQuery(*QueryArgs) (*modconfig.ResolvedQuery, error)
	RequiresExecution(QueryProvider) bool
	ValidateQuery() hcl.Diagnostics
	MergeParentArgs(QueryProvider, QueryProvider) hcl.Diagnostics
	GetQueryProviderImpl() *QueryProviderImpl
	ParamsInheritedFromBase() bool
	ArgsInheritedFromBase() bool
}

QueryProvider must be implemented by resources which have query/sql

type QueryProviderImpl

type QueryProviderImpl struct {
	RuntimeDependencyProviderImpl
	QueryProviderRemain hcl.Body `hcl:",remain" json:"-"`

	SQL       *string               `cty:"sql" hcl:"sql" json:"sql,omitempty"`
	Query     *Query                `cty:"query" hcl:"query" json:"-"`
	Args      *QueryArgs            `cty:"args" json:"args,omitempty"`
	Params    []*modconfig.ParamDef `cty:"params" json:"params,omitempty"`
	QueryName *string               `json:"query,omitempty"`
	// contains filtered or unexported fields
}

func NewQueryProviderImpl

func NewQueryProviderImpl(block *hcl.Block, mod *modconfig.Mod, shortName string) QueryProviderImpl

func (*QueryProviderImpl) ArgsInheritedFromBase

func (q *QueryProviderImpl) ArgsInheritedFromBase() bool

ArgsInheritedFromBase implements QueryProvider determine whether our args were inherited from base resource

func (*QueryProviderImpl) CtyValue

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

CtyValue implements CtyValueProvider

func (*QueryProviderImpl) Diff

func (*QueryProviderImpl) GetArgs

func (q *QueryProviderImpl) GetArgs() *QueryArgs

GetArgs implements QueryProvider

func (*QueryProviderImpl) GetNestedStructs

func (b *QueryProviderImpl) GetNestedStructs() []modconfig.CtyValueProvider

func (*QueryProviderImpl) GetParams

func (q *QueryProviderImpl) GetParams() []*modconfig.ParamDef

GetParams implements QueryProvider

func (*QueryProviderImpl) GetQuery

func (q *QueryProviderImpl) GetQuery() *Query

GetQuery implements QueryProvider

func (*QueryProviderImpl) GetQueryProviderImpl

func (q *QueryProviderImpl) GetQueryProviderImpl() *QueryProviderImpl

GetQueryProviderImpl implements QueryProvider

func (*QueryProviderImpl) GetResolvedQuery

func (q *QueryProviderImpl) GetResolvedQuery(runtimeArgs *QueryArgs) (*modconfig.ResolvedQuery, error)

GetResolvedQuery return the SQL and args to run the query

func (*QueryProviderImpl) GetSQL

func (q *QueryProviderImpl) GetSQL() *string

GetSQL implements QueryProvider

func (*QueryProviderImpl) GetShowData

func (q *QueryProviderImpl) GetShowData() *printers.RowData

GetShowData implements printers.Showable

func (*QueryProviderImpl) MergeParentArgs

func (q *QueryProviderImpl) MergeParentArgs(queryProvider QueryProvider, parent QueryProvider) (diags hcl.Diagnostics)

MergeParentArgs merges our args with our parent args (ours take precedence)

func (*QueryProviderImpl) OnDecoded

func (q *QueryProviderImpl) OnDecoded(block *hcl.Block, _ modconfig.ModResourcesProvider) hcl.Diagnostics

func (*QueryProviderImpl) ParamsInheritedFromBase

func (q *QueryProviderImpl) ParamsInheritedFromBase() bool

ParamsInheritedFromBase implements QueryProvider determine whether our params were inherited from base resource

func (*QueryProviderImpl) RequiresExecution

func (q *QueryProviderImpl) RequiresExecution(queryProvider QueryProvider) bool

RequiresExecution implements QueryProvider

func (*QueryProviderImpl) SetArgs

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

SetArgs implements QueryProvider

func (*QueryProviderImpl) SetBaseProperties

func (q *QueryProviderImpl) SetBaseProperties()

func (*QueryProviderImpl) SetParams

func (q *QueryProviderImpl) SetParams(params []*modconfig.ParamDef)

SetParams implements QueryProvider

func (*QueryProviderImpl) ValidateQuery

func (q *QueryProviderImpl) ValidateQuery() hcl.Diagnostics

ValidateQuery implements QueryProvider returns an error if neither sql or query are set it is overridden by resource types for which sql is optional

type RuntimeDependency

type RuntimeDependency struct {
	PropertyPath       *modconfig.ParsedPropertyPath
	TargetPropertyName *string
	// TACTICAL the name of the parent property - either "args" or "param.<name>"
	ParentPropertyName  string
	TargetPropertyIndex *int

	// TACTICAL - if set, wrap the dependency value in an array
	// this provides support for args which convert a runtime dependency to an array, like:
	// arns = [input.arn]
	IsArray bool

	// resource which provides has the dependency
	Provider modconfig.HclResource
}

func (*RuntimeDependency) Equals

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

func (*RuntimeDependency) SourceResourceName

func (d *RuntimeDependency) SourceResourceName() string

func (*RuntimeDependency) String

func (d *RuntimeDependency) String() string

func (*RuntimeDependency) ValidateSource

func (d *RuntimeDependency) ValidateSource(dashboard *Dashboard, workspace modconfig.ModResourcesProvider) error

type RuntimeDependencyProvider

type RuntimeDependencyProvider interface {
	modconfig.ModTreeItem
	AddRuntimeDependencies([]*RuntimeDependency)
	GetRuntimeDependencies() map[string]*RuntimeDependency
}

RuntimeDependencyProvider is implemented by all QueryProviders and Dashboard

type RuntimeDependencyProviderImpl

type RuntimeDependencyProviderImpl struct {
	modconfig.ModTreeItemImpl
	// required to allow partial decoding
	RuntimeDependencyProviderRemain hcl.Body `hcl:",remain" json:"-"`
	// contains filtered or unexported fields
}

func (*RuntimeDependencyProviderImpl) AddRuntimeDependencies

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

func (*RuntimeDependencyProviderImpl) GetNestedStructs

func (*RuntimeDependencyProviderImpl) GetRuntimeDependencies

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

type WithProvider

type WithProvider interface {
	AddWith(with *DashboardWith) hcl.Diagnostics
	GetWiths() []*DashboardWith
	GetWith(string) (*DashboardWith, bool)
}

type WithProviderImpl

type WithProviderImpl struct {
	// required to allow partial decoding
	WithProviderRemain hcl.Body `hcl:",remain" json:"-"`
	// contains filtered or unexported fields
}

func (*WithProviderImpl) AddWith

func (b *WithProviderImpl) AddWith(with *DashboardWith) hcl.Diagnostics

func (*WithProviderImpl) GetWith

func (b *WithProviderImpl) GetWith(name string) (*DashboardWith, bool)

func (*WithProviderImpl) GetWiths

func (b *WithProviderImpl) GetWiths() []*DashboardWith

Jump to

Keyboard shortcuts

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