Documentation ¶
Index ¶
- Variables
- func FilterWorkspaceResourcesOfType[T modconfig.HclResource](w *Workspace, filter ResourceFilter) (map[string]T, error)
- func FindModFilePath(folder string) (string, error)
- func GetWorkspaceResourcesOfType[T modconfig.HclResource](w *Workspace) map[string]T
- func HomeDirectoryModfileCheck(ctx context.Context, workspacePath string) error
- func ResolveResourceAndArgsFromSQLString[T modconfig.ModTreeItem](sqlString string, w *Workspace) (modconfig.ModTreeItem, *modconfig.QueryArgs, error)
- func SqlLooksLikeExecutableResource(input string) (string, bool)
- type LoadWorkspaceConfig
- type LoadWorkspaceOption
- func WithBlockType(blockTypeInclusions []string) LoadWorkspaceOption
- func WithCredentials(credentials map[string]credential.Credential) LoadWorkspaceOption
- func WithIntegrations(integrations map[string]modconfig.Integration) LoadWorkspaceOption
- func WithNotifiers(notifiers map[string]modconfig.Notifier) LoadWorkspaceOption
- func WithSkipResourceLoadIfNoModfile(enabled bool) LoadWorkspaceOption
- func WithVariableValidation(enabled bool) LoadWorkspaceOption
- type ResourceFilter
- type Workspace
- func (w *Workspace) Close()
- func (w *Workspace) GetQueryProvider(queryName string) (modconfig.QueryProvider, bool)
- func (w *Workspace) GetResource(parsedName *modconfig.ParsedResourceName) (resource modconfig.HclResource, found bool)
- func (w *Workspace) GetResourceMaps() *modconfig.ResourceMaps
- func (w *Workspace) ModfileExists() bool
- func (w *Workspace) ReloadResourceMaps(ctx context.Context) (*modconfig.ResourceMaps, *modconfig.ResourceMaps, ...)
- func (w *Workspace) ResolveQueryFromQueryProvider(queryProvider modconfig.QueryProvider, runtimeArgs *modconfig.QueryArgs) (*modconfig.ResolvedQuery, error)
- func (w *Workspace) SetOnFileWatcherEventMessages(f func())
- func (w *Workspace) SetupWatcher(ctx context.Context, errorHandler func(context.Context, error)) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrorNoModDefinition = fmt.Errorf("no modfile found")
)
var EventCount int64 = 0
Functions ¶
func FilterWorkspaceResourcesOfType ¶ added in v0.3.0
func FilterWorkspaceResourcesOfType[T modconfig.HclResource](w *Workspace, filter ResourceFilter) (map[string]T, error)
FilterWorkspaceResourcesOfType returns all resources of type T from a workspace which satisf y the filter, which is specified as a SQL syntax where clause
func FindModFilePath ¶
FindModFilePath search up the directory tree to find the modfile
func GetWorkspaceResourcesOfType ¶
func GetWorkspaceResourcesOfType[T modconfig.HclResource](w *Workspace) map[string]T
GetWorkspaceResourcesOfType returns all resources of type T from a workspace
func ResolveResourceAndArgsFromSQLString ¶ added in v0.3.0
func ResolveResourceAndArgsFromSQLString[T modconfig.ModTreeItem](sqlString string, w *Workspace) (modconfig.ModTreeItem, *modconfig.QueryArgs, error)
ResolveResourceAndArgsFromSQLString attempts to resolve 'arg' to a resource of type T and (optionally) query args
func SqlLooksLikeExecutableResource ¶ added in v0.3.0
Types ¶
type LoadWorkspaceConfig ¶ added in v0.3.0
type LoadWorkspaceConfig struct {
// contains filtered or unexported fields
}
type LoadWorkspaceOption ¶ added in v0.3.0
type LoadWorkspaceOption func(*LoadWorkspaceConfig)
func WithBlockType ¶ added in v0.3.0
func WithBlockType(blockTypeInclusions []string) LoadWorkspaceOption
func WithCredentials ¶ added in v0.3.0
func WithCredentials(credentials map[string]credential.Credential) LoadWorkspaceOption
func WithIntegrations ¶ added in v0.3.0
func WithIntegrations(integrations map[string]modconfig.Integration) LoadWorkspaceOption
func WithNotifiers ¶ added in v0.3.0
func WithNotifiers(notifiers map[string]modconfig.Notifier) LoadWorkspaceOption
func WithSkipResourceLoadIfNoModfile ¶ added in v0.3.0
func WithSkipResourceLoadIfNoModfile(enabled bool) LoadWorkspaceOption
TODO this is only needed as Pipe fittings tests rely on loading workspaces without modfiles
func WithVariableValidation ¶ added in v0.3.0
func WithVariableValidation(enabled bool) LoadWorkspaceOption
type ResourceFilter ¶ added in v0.3.0
type ResourceFilter struct { Where string Tags map[string]string WherePredicate func(item modconfig.HclResource) bool }
func ResourceFilterFromTags ¶ added in v0.3.0
func ResourceFilterFromTags(tags []string) ResourceFilter
ResourceFilterFromTags creates a ResourceFilter from a list of tag values of the form 'key=value'
func (*ResourceFilter) Empty ¶ added in v0.3.0
func (f *ResourceFilter) Empty() bool
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 // Credentials are something different, it's not part of the mod, it's not part of the workspace, it is at the same level // with mod and workspace. However, it can be referenced by the mod, so it needs to be in the parse context Credentials map[string]credential.Credential Integrations map[string]modconfig.Integration Notifiers map[string]modconfig.Notifier 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 // hooks OnFileWatcherError func(context.Context, error) OnFileWatcherEvent func(context.Context, *modconfig.ResourceMaps, *modconfig.ResourceMaps) BlockTypeInclusions []string // contains filtered or unexported fields }
func Load ¶
func Load(ctx context.Context, workspacePath string, opts ...LoadWorkspaceOption) (w *Workspace, ew error_helpers.ErrorAndWarnings)
func LoadWorkspacePromptingForVariables ¶
func LoadWorkspacePromptingForVariables(ctx context.Context, workspacePath string, opts ...LoadWorkspaceOption) (*Workspace, error_helpers.ErrorAndWarnings)
func (*Workspace) GetQueryProvider ¶
func (w *Workspace) GetQueryProvider(queryName string) (modconfig.QueryProvider, bool)
func (*Workspace) GetResource ¶
func (w *Workspace) GetResource(parsedName *modconfig.ParsedResourceName) (resource modconfig.HclResource, found bool)
func (*Workspace) GetResourceMaps ¶
func (w *Workspace) GetResourceMaps() *modconfig.ResourceMaps
GetResourceMaps implements ResourceMapsProvider
func (*Workspace) ModfileExists ¶
func (*Workspace) ReloadResourceMaps ¶ added in v0.3.0
func (w *Workspace) ReloadResourceMaps(ctx context.Context) (*modconfig.ResourceMaps, *modconfig.ResourceMaps, error_helpers.ErrorAndWarnings)
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())