dashboardexecute

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecutionCompleteToSnapshot

func ExecutionCompleteToSnapshot(event *dashboardevents.ExecutionComplete) *steampipeconfig.SteampipeSnapshot

ExecutionCompleteToSnapshot transforms the ExecutionComplete event into a SteampipeSnapshot

func GenerateSnapshot

func GenerateSnapshot(ctx context.Context, w *dashboardworkspace.WorkspaceEvents, rootResource modconfig.ModTreeItem, inputs map[string]any) (snapshot *steampipeconfig.SteampipeSnapshot, err error)

func GetReferencedVariables

GetReferencedVariables builds map of variables values containing only those mod variables which are referenced NOTE: we refer to variables in dependency mods in the format which is valid for an SPVARS filer, i.e. <mod>.<var-name> the VariableValues map will contain these variables with the name format <mod>.var.<var-name>, so we must convert the name

Types

type CheckRun

type CheckRun struct {
	DashboardParentImpl

	Summary   *controlexecute.GroupSummary     `json:"summary"`
	SessionId string                           `json:"-"`
	Root      controlexecute.ExecutionTreeNode `json:"-"`
	// contains filtered or unexported fields
}

CheckRun is a struct representing the execution of a control or benchmark

func NewCheckRun

func NewCheckRun(resource modconfig.DashboardLeafNode, parent dashboardtypes.DashboardParent, executionTree *DashboardExecutionTree) (*CheckRun, error)

func (*CheckRun) AsTreeNode

func (r *CheckRun) AsTreeNode() *steampipeconfig.SnapshotTreeNode

func (*CheckRun) BuildSnapshotPanels

func (r *CheckRun) BuildSnapshotPanels(leafNodeMap map[string]steampipeconfig.SnapshotPanel) map[string]steampipeconfig.SnapshotPanel

BuildSnapshotPanels is a custom implementation of BuildSnapshotPanels - be nice to just use the DashboardExecutionTree but work is needed on common interface types/generics

func (*CheckRun) ChildrenComplete

func (r *CheckRun) ChildrenComplete() bool

ChildrenComplete implements DashboardTreeRun (override base)

func (*CheckRun) Execute

func (r *CheckRun) Execute(ctx context.Context)

Execute implements DashboardTreeRun

func (*CheckRun) Initialise

func (r *CheckRun) Initialise(ctx context.Context)

Initialise implements DashboardTreeRun

func (*CheckRun) IsSnapshotPanel

func (*CheckRun) IsSnapshotPanel()

IsSnapshotPanel implements SnapshotPanel

func (*CheckRun) SetComplete

func (r *CheckRun) SetComplete(ctx context.Context)

SetComplete implements DashboardTreeRun (override to set snapshothook status

func (*CheckRun) SetError

func (r *CheckRun) SetError(ctx context.Context, err error)

SetError implements DashboardTreeRun (override to set snapshothook status

type DashboardContainerRun

type DashboardContainerRun struct {
	DashboardParentImpl
	// contains filtered or unexported fields
}

DashboardContainerRun is a struct representing a container run

func (*DashboardContainerRun) AsTreeNode

func (*DashboardContainerRun) Execute

func (r *DashboardContainerRun) Execute(ctx context.Context)

Execute implements DashboardTreeRun execute all children and wait for them to complete

func (*DashboardContainerRun) Initialise

func (r *DashboardContainerRun) Initialise(ctx context.Context)

Initialise implements DashboardTreeRun

func (*DashboardContainerRun) IsSnapshotPanel

func (*DashboardContainerRun) IsSnapshotPanel()

IsSnapshotPanel implements SnapshotPanel

type DashboardEventControlHooks

type DashboardEventControlHooks struct {
	CheckRun *CheckRun
}

DashboardEventControlHooks is a struct which implements ControlHooks, and raises ControlComplete and ControlError dashboard events

func NewDashboardEventControlHooks

func NewDashboardEventControlHooks(r *CheckRun) *DashboardEventControlHooks

func (*DashboardEventControlHooks) OnComplete

func (*DashboardEventControlHooks) OnControlComplete

func (*DashboardEventControlHooks) OnControlError

func (*DashboardEventControlHooks) OnStart

type DashboardExecutionTree

type DashboardExecutionTree struct {
	Root dashboardtypes.DashboardTreeRun
	// contains filtered or unexported fields
}

DashboardExecutionTree is a structure representing the control result hierarchy

func (*DashboardExecutionTree) AsTreeNode

func (*DashboardExecutionTree) BuildSnapshotPanels

func (e *DashboardExecutionTree) BuildSnapshotPanels() map[string]steampipeconfig.SnapshotPanel

func (*DashboardExecutionTree) Cancel

func (e *DashboardExecutionTree) Cancel()

func (*DashboardExecutionTree) ChildCompleteChan

func (e *DashboardExecutionTree) ChildCompleteChan() chan dashboardtypes.DashboardTreeRun

ChildCompleteChan implements DashboardParent

func (*DashboardExecutionTree) ChildStatusChanged

func (*DashboardExecutionTree) ChildStatusChanged(context.Context)

ChildStatusChanged implements DashboardParent

func (*DashboardExecutionTree) ChildrenComplete

func (e *DashboardExecutionTree) ChildrenComplete() bool

ChildrenComplete implements DashboardParent

func (*DashboardExecutionTree) Execute

func (e *DashboardExecutionTree) Execute(ctx context.Context)

func (*DashboardExecutionTree) GetChildren

GetChildren implements DashboardParent

func (*DashboardExecutionTree) GetError

func (e *DashboardExecutionTree) GetError() error

func (*DashboardExecutionTree) GetInputsDependingOn

func (e *DashboardExecutionTree) GetInputsDependingOn(s string) []string

func (*DashboardExecutionTree) GetName

func (e *DashboardExecutionTree) GetName() string

GetName implements DashboardParent use mod short name - this will be the root name for all child runs

func (*DashboardExecutionTree) GetNodeType

func (*DashboardExecutionTree) GetNodeType() string

GetNodeType implements DashboardTreeRun

func (*DashboardExecutionTree) GetParent

GetParent implements DashboardTreeRun

func (*DashboardExecutionTree) GetResource

func (*DashboardExecutionTree) GetRunStatus

GetRunStatus returns the stats of the Root run

func (*DashboardExecutionTree) GetTitle

func (e *DashboardExecutionTree) GetTitle() string

func (*DashboardExecutionTree) Initialise

func (e *DashboardExecutionTree) Initialise(ctx context.Context)

func (*DashboardExecutionTree) InputRuntimeDependencies

func (e *DashboardExecutionTree) InputRuntimeDependencies() []string

InputRuntimeDependencies returns the names of all inputs which are runtime dependencies

func (*DashboardExecutionTree) RunComplete

func (e *DashboardExecutionTree) RunComplete() bool

func (*DashboardExecutionTree) SetComplete

func (e *DashboardExecutionTree) SetComplete(ctx context.Context)

func (*DashboardExecutionTree) SetError

func (e *DashboardExecutionTree) SetError(ctx context.Context, err error)

SetError sets the error on the Root run

func (*DashboardExecutionTree) SetInputValues

func (e *DashboardExecutionTree) SetInputValues(inputValues map[string]any)

type DashboardExecutor

type DashboardExecutor struct {
	// contains filtered or unexported fields
}
var Executor *DashboardExecutor

func NewDashboardExecutor

func NewDashboardExecutor(defaultClient *db_client.ClientMap) *DashboardExecutor

func (*DashboardExecutor) CancelExecutionForSession

func (e *DashboardExecutor) CancelExecutionForSession(_ context.Context, sessionId string)

func (*DashboardExecutor) ExecuteDashboard

func (e *DashboardExecutor) ExecuteDashboard(ctx context.Context, sessionId string, rootResource modconfig.ModTreeItem, inputs map[string]any, workspace *dashboardworkspace.WorkspaceEvents, opts ...backend.ConnectOption) (err error)

func (*DashboardExecutor) LoadSnapshot

func (e *DashboardExecutor) LoadSnapshot(ctx context.Context, sessionId, snapshotName string, w *dashboardworkspace.WorkspaceEvents) (map[string]any, error)

func (*DashboardExecutor) OnInputChanged

func (e *DashboardExecutor) OnInputChanged(ctx context.Context, sessionId string, inputs map[string]any, changedInput string) error

type DashboardParentImpl

type DashboardParentImpl struct {
	DashboardTreeRunImpl
	// contains filtered or unexported fields
}

func (*DashboardParentImpl) ChildCompleteChan

func (r *DashboardParentImpl) ChildCompleteChan() chan dashboardtypes.DashboardTreeRun

func (*DashboardParentImpl) ChildStatusChanged

func (r *DashboardParentImpl) ChildStatusChanged(ctx context.Context)

func (*DashboardParentImpl) ChildrenComplete

func (r *DashboardParentImpl) ChildrenComplete() bool

ChildrenComplete implements DashboardTreeRun

func (*DashboardParentImpl) GetChildren

GetChildren implements DashboardTreeRun

type DashboardRun

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

DashboardRun is a struct representing a container run

func NewDashboardRun

func NewDashboardRun(dashboard *modconfig.Dashboard, parent dashboardtypes.DashboardParent, executionTree *DashboardExecutionTree) (*DashboardRun, error)

func (*DashboardRun) AsTreeNode

func (*DashboardRun) Execute

func (r *DashboardRun) Execute(ctx context.Context)

Execute implements DashboardTreeRun execute all children and wait for them to complete

func (*DashboardRun) GetInput

func (r *DashboardRun) GetInput(name string) (*modconfig.DashboardInput, bool)

GetInput searches for an input with the given name

func (*DashboardRun) GetInputsDependingOn

func (r *DashboardRun) GetInputsDependingOn(changedInputName string) []string

GetInputsDependingOn returns a list o DashboardInputs which have a runtime dependency on the given input

func (*DashboardRun) GetName

func (p *DashboardRun) GetName() string

func (*DashboardRun) GetWithRuns

func (p *DashboardRun) GetWithRuns() map[string]*LeafRun

func (*DashboardRun) Initialise

func (r *DashboardRun) Initialise(ctx context.Context)

Initialise implements DashboardTreeRun

func (*DashboardRun) IsSnapshotPanel

func (*DashboardRun) IsSnapshotPanel()

IsSnapshotPanel implements SnapshotPanel

func (*DashboardRun) ProvidesRuntimeDependency

func (p *DashboardRun) ProvidesRuntimeDependency(dependency *modconfig.RuntimeDependency) bool

func (*DashboardRun) PublishRuntimeDependencyValue

func (p *DashboardRun) PublishRuntimeDependencyValue(name string, result *dashboardtypes.ResolvedRuntimeDependencyValue)

func (*DashboardRun) SubscribeToRuntimeDependency

func (p *DashboardRun) SubscribeToRuntimeDependency(name string, opts ...RuntimeDependencyPublishOption) chan *dashboardtypes.ResolvedRuntimeDependencyValue

type DashboardTreeRunImpl

type DashboardTreeRunImpl struct {
	DashboardName    string                   `json:"dashboard"`
	Description      string                   `json:"description,omitempty"`
	Display          string                   `cty:"display" hcl:"display" json:"display,omitempty"`
	Documentation    string                   `json:"documentation,omitempty"`
	ErrorString      string                   `json:"error,omitempty"`
	Name             string                   `json:"name"`
	NodeType         string                   `json:"panel_type"`
	SourceDefinition string                   `json:"source_definition"`
	Status           dashboardtypes.RunStatus `json:"status"`
	Tags             map[string]string        `json:"tags,omitempty"`
	Title            string                   `json:"title,omitempty"`
	Type             string                   `json:"display_type,omitempty"`
	Width            int                      `json:"width,omitempty"`
	// contains filtered or unexported fields
}

func (*DashboardTreeRunImpl) AsTreeNode

AsTreeNode implements DashboardTreeRun

func (*DashboardTreeRunImpl) Execute

func (r *DashboardTreeRunImpl) Execute(ctx context.Context)

Execute implements DashboardTreeRun

func (*DashboardTreeRunImpl) GetError

func (r *DashboardTreeRunImpl) GetError() error

GetError implements DashboardTreeRun

func (*DashboardTreeRunImpl) GetInputsDependingOn

func (r *DashboardTreeRunImpl) GetInputsDependingOn(_ string) []string

GetInputsDependingOn implements DashboardTreeRun defaults to nothing

func (*DashboardTreeRunImpl) GetName

func (r *DashboardTreeRunImpl) GetName() string

GetName implements DashboardTreeRun

func (*DashboardTreeRunImpl) GetNodeType

func (r *DashboardTreeRunImpl) GetNodeType() string

GetNodeType implements DashboardTreeRun

func (*DashboardTreeRunImpl) GetParent

GetParent implements DashboardTreeRun

func (*DashboardTreeRunImpl) GetResource

GetResource implements DashboardTreeRun

func (*DashboardTreeRunImpl) GetRunStatus

func (r *DashboardTreeRunImpl) GetRunStatus() dashboardtypes.RunStatus

GetRunStatus implements DashboardTreeRun

func (*DashboardTreeRunImpl) GetTitle

func (r *DashboardTreeRunImpl) GetTitle() string

GetTitle implements DashboardTreeRun

func (*DashboardTreeRunImpl) Initialise

func (r *DashboardTreeRunImpl) Initialise(context.Context)

Initialise implements DashboardTreeRun

func (*DashboardTreeRunImpl) RunComplete

func (r *DashboardTreeRunImpl) RunComplete() bool

RunComplete implements DashboardTreeRun

func (*DashboardTreeRunImpl) SetComplete

func (r *DashboardTreeRunImpl) SetComplete(ctx context.Context)

SetComplete implements DashboardTreeRun

func (*DashboardTreeRunImpl) SetError

func (r *DashboardTreeRunImpl) SetError(ctx context.Context, err error)

SetError implements DashboardTreeRun

type LeafRun

type LeafRun struct {
	// all RuntimeDependencySubscribers are also publishers as they have args/params
	RuntimeDependencySubscriberImpl

	Resource modconfig.DashboardLeafNode `json:"-"`
	// this is populated by retrieving Resource properties with the snapshot tag
	Properties map[string]any           `json:"properties,omitempty"`
	Data       *dashboardtypes.LeafData `json:"data,omitempty"`
	// contains filtered or unexported fields
}

LeafRun is a struct representing the execution of a leaf dashboard node

func NewLeafRun

func NewLeafRun(resource modconfig.DashboardLeafNode, parent dashboardtypes.DashboardParent, executionTree *DashboardExecutionTree, opts ...LeafRunOption) (*LeafRun, error)

func (*LeafRun) AsTreeNode

func (r *LeafRun) AsTreeNode() *steampipeconfig.SnapshotTreeNode

func (*LeafRun) Execute

func (r *LeafRun) Execute(ctx context.Context)

Execute implements DashboardTreeRun

func (*LeafRun) GetName

func (p *LeafRun) GetName() string

func (*LeafRun) GetWithRuns

func (p *LeafRun) GetWithRuns() map[string]*LeafRun

func (*LeafRun) Initialise

func (p *LeafRun) Initialise(context.Context)

func (*LeafRun) IsSnapshotPanel

func (*LeafRun) IsSnapshotPanel()

IsSnapshotPanel implements SnapshotPanel

func (*LeafRun) ProvidesRuntimeDependency

func (p *LeafRun) ProvidesRuntimeDependency(dependency *modconfig.RuntimeDependency) bool

func (*LeafRun) PublishRuntimeDependencyValue

func (p *LeafRun) PublishRuntimeDependencyValue(name string, result *dashboardtypes.ResolvedRuntimeDependencyValue)

func (*LeafRun) SetComplete

func (r *LeafRun) SetComplete(ctx context.Context)

SetComplete implements DashboardTreeRun (override to set snapshothook status

func (*LeafRun) SetError

func (r *LeafRun) SetError(ctx context.Context, err error)

SetError implements DashboardTreeRun (override to set snapshothook status)

func (*LeafRun) SubscribeToRuntimeDependency

func (p *LeafRun) SubscribeToRuntimeDependency(name string, opts ...RuntimeDependencyPublishOption) chan *dashboardtypes.ResolvedRuntimeDependencyValue

type LeafRunOption

type LeafRunOption = func(target *LeafRun)

type RuntimeDependencyPublishTarget

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

type RuntimeDependencyPublisher

type RuntimeDependencyPublisher interface {
	dashboardtypes.DashboardTreeRun
	ProvidesRuntimeDependency(dependency *modconfig.RuntimeDependency) bool
	SubscribeToRuntimeDependency(name string, opts ...RuntimeDependencyPublishOption) chan *dashboardtypes.ResolvedRuntimeDependencyValue
	PublishRuntimeDependencyValue(name string, result *dashboardtypes.ResolvedRuntimeDependencyValue)
	GetWithRuns() map[string]*LeafRun
}

type RuntimeDependencySubscriber

type RuntimeDependencySubscriber interface {
	RuntimeDependencyPublisher
	GetBaseDependencySubscriber() RuntimeDependencySubscriber
}

type RuntimeDependencySubscriberImpl

type RuntimeDependencySubscriberImpl struct {
	RawSQL string `json:"sql,omitempty"`

	// a list of the (scoped) names of any runtime dependencies that we rely on
	RuntimeDependencyNames []string `json:"dependencies,omitempty"`
	// contains filtered or unexported fields
}

func (*RuntimeDependencySubscriberImpl) AsTreeNode

func (p *RuntimeDependencySubscriberImpl) AsTreeNode() *steampipeconfig.SnapshotTreeNode

func (*RuntimeDependencySubscriberImpl) Execute

func (p *RuntimeDependencySubscriberImpl) Execute(context.Context)

func (*RuntimeDependencySubscriberImpl) GetBaseDependencySubscriber

func (s *RuntimeDependencySubscriberImpl) GetBaseDependencySubscriber() RuntimeDependencySubscriber

GetBaseDependencySubscriber implements RuntimeDependencySubscriber

func (*RuntimeDependencySubscriberImpl) GetName

func (p *RuntimeDependencySubscriberImpl) GetName() string

func (*RuntimeDependencySubscriberImpl) GetWithRuns

func (p *RuntimeDependencySubscriberImpl) GetWithRuns() map[string]*LeafRun

func (*RuntimeDependencySubscriberImpl) Initialise

func (p *RuntimeDependencySubscriberImpl) Initialise(context.Context)

func (*RuntimeDependencySubscriberImpl) ProvidesRuntimeDependency

func (p *RuntimeDependencySubscriberImpl) ProvidesRuntimeDependency(dependency *modconfig.RuntimeDependency) bool

func (*RuntimeDependencySubscriberImpl) PublishRuntimeDependencyValue

func (p *RuntimeDependencySubscriberImpl) PublishRuntimeDependencyValue(name string, result *dashboardtypes.ResolvedRuntimeDependencyValue)

func (*RuntimeDependencySubscriberImpl) SubscribeToRuntimeDependency

func (p *RuntimeDependencySubscriberImpl) SubscribeToRuntimeDependency(name string, opts ...RuntimeDependencyPublishOption) chan *dashboardtypes.ResolvedRuntimeDependencyValue

Jump to

Keyboard shortcuts

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