workspace

package
v0.17.0-alpha.30 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNoModDefinition = errors.New("this command requires a mod definition file - could not find in the current directory tree")
)

Functions

func EnsureSessionData

func EnsureSessionData(ctx context.Context, source *SessionDataSource, conn *pgx.Conn) (error, map[string]error)

EnsureSessionData determines whether session scoped data (introspection tables and prepared statements) exists for this session, and if not, creates it

func LoadResourceNames

func LoadResourceNames(workspacePath string) (*modconfig.WorkspaceResources, error)

LoadResourceNames builds lists of all workspace resource names

func LoadVariables

func LoadVariables(ctx context.Context, workspacePath string) ([]*modconfig.Variable, error)

LoadVariables creates a Workspace and uses it to load all variables, ignoring any value resolution errors this is use for the variable list command

Types

type SessionDataSource

type SessionDataSource struct {
	PreparedStatementSource  func() *modconfig.ResourceMaps
	IntrospectionTableSource func() *modconfig.ResourceMaps
}

func NewSessionDataSource

func NewSessionDataSource(w *Workspace, preparedStatementSource *modconfig.ResourceMaps) *SessionDataSource

NewSessionDataSource uses the workspace and (optionally) a separate the prepared statemeot source and returns a SessionDataSource NOTE: preparedStatementSource is only set if specific queries have ben passed to the query command it allows us to only create the prepared statements me need

type Workspace

type Workspace struct {
	Path                string
	ModInstallationPath string
	Mod                 *modconfig.Mod

	Mods map[string]*modconfig.Mod
	// the input variables used in the parse
	VariableValues map[string]string
	CloudMetadata  *steampipeconfig.CloudMetadata

	// source snapshot paths
	// if this is set, no other mod resources are loaded and
	// the ResourceMaps returned by GetModResources will contain only the snapshots
	SourceSnapshots []string
	// contains filtered or unexported fields
}

func Load

func Load(ctx context.Context, workspacePath string) (*Workspace, error)

Load creates a Workspace and loads the workspace mod

func (*Workspace) CheckRequiredPluginsInstalled

func (w *Workspace) CheckRequiredPluginsInstalled() error

func (*Workspace) Close

func (w *Workspace) Close()

func (*Workspace) GetPreparedStatementCreationFailure added in v0.17.0

func (w *Workspace) GetPreparedStatementCreationFailure(queryName string) *steampipeconfig.PreparedStatementFailure

GetPreparedStatementCreationFailure looks for a prepared statement error for the given query and if found, returns the query and the prepared statement creation error (if any)

func (*Workspace) GetPreparedStatementFailures added in v0.17.0

func (w *Workspace) GetPreparedStatementFailures() map[string]*steampipeconfig.PreparedStatementFailure

func (*Workspace) GetQueriesFromArgs

func (w *Workspace) GetQueriesFromArgs(args []string) (map[string]string, *modconfig.ResourceMaps, error)

GetQueriesFromArgs retrieves queries from args

For each arg check if it is a named query or a file, before falling back to treating it as sql

func (*Workspace) GetQueryProvider added in v0.17.0

func (w *Workspace) GetQueryProvider(queryName string) (modconfig.QueryProvider, bool)

func (*Workspace) GetResourceMaps

func (w *Workspace) GetResourceMaps() *modconfig.ResourceMaps

GetResourceMaps implements ResourceMapsProvider

func (*Workspace) HandlePreparedStatementFailures added in v0.17.0

func (w *Workspace) HandlePreparedStatementFailures(failures map[string]error)

func (*Workspace) ModfileExists

func (w *Workspace) ModfileExists() bool

func (*Workspace) PublishDashboardEvent

func (w *Workspace) PublishDashboardEvent(e dashboardevents.DashboardEvent)

func (*Workspace) RegisterDashboardEventHandler

func (w *Workspace) RegisterDashboardEventHandler(handler dashboardevents.DashboardEventHandler)

RegisterDashboardEventHandler starts the event handler goroutine if necessary and adds the event handler to our list

func (*Workspace) ResolveQueryAndArgsFromSQLString

func (w *Workspace) ResolveQueryAndArgsFromSQLString(sqlString string) (string, modconfig.QueryProvider, error)

ResolveQueryAndArgsFromSQLString attempts to resolve 'arg' to a query and query args

func (*Workspace) ResolveQueryFromQueryProvider

func (w *Workspace) ResolveQueryFromQueryProvider(queryProvider modconfig.QueryProvider, runtimeArgs *modconfig.QueryArgs) (*modconfig.ResolvedQuery, error)

ResolveQueryFromQueryProvider resolves the query for the given QueryProvider

func (*Workspace) SetOnFileWatcherEventMessages

func (w *Workspace) SetOnFileWatcherEventMessages(f func())

func (*Workspace) SetupWatcher

func (w *Workspace) SetupWatcher(ctx context.Context, client db_common.Client, errorHandler func(context.Context, error)) error

func (*Workspace) UnregisterDashboardEventHandlers added in v0.17.0

func (w *Workspace) UnregisterDashboardEventHandlers()

UnregisterDashboardEventHandlers clears all event handlers used when generating multiple snapshots

func (*Workspace) ValidateSteampipeVersion

func (w *Workspace) ValidateSteampipeVersion() error

Jump to

Keyboard shortcuts

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