workspace

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: AGPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNoModDefinition = fmt.Errorf("no modfile found")
)
View Source
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

func FindModFilePath(folder string) (string, error)

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 HandleWorkspaceLoadError added in v1.7.0

func HandleWorkspaceLoadError(ctx context.Context, err error, workspacePath string) error

func HomeDirectoryModfileCheck

func HomeDirectoryModfileCheck(ctx context.Context, workspacePath string) error

func SqlLike added in v1.0.0

func SqlLike(input, pattern string, caseSensitive bool) bool

SqlLike simulates SQL LIKE pattern matching using fnmatch, with an option for case sensitivity.

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 WithConfigValueMap added in v1.7.0

func WithConfigValueMap(name string, valueMap map[string]cty.Value) LoadWorkspaceOption

func WithDecoderOptions added in v1.7.0

func WithDecoderOptions(opts ...parse.DecoderOption) LoadWorkspaceOption

func WithLateBinding added in v1.6.0

func WithLateBinding(enabled bool) LoadWorkspaceOption

func WithPipelingConnections added in v1.6.0

func WithPipelingConnections(pipelingConnections map[string]connection.PipelingConnection) 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

	PipelingConnections map[string]connection.PipelingConnection

	Mods map[string]*modconfig.Mod

	// the input variables used in the parse
	VariableValues map[string]string

	FileWatcherErrorHandler func(context.Context, error)
	WatcherError            error

	// hooks
	OnFileWatcherError  func(context.Context, error)
	OnFileWatcherEvent  func(context.Context, modconfig.ModResources, modconfig.ModResources)
	BlockTypeInclusions []string
	ValidateVariables   bool
	SupportLateBinding  bool
	// 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) Close

func (w *Workspace) Close()

func (*Workspace) GetModResources added in v1.7.0

func (w *Workspace) GetModResources() modconfig.ModResources

GetModResources implements ModResourcesProvider

func (*Workspace) GetParseContext added in v1.7.0

func (w *Workspace) GetParseContext(ctx context.Context) (*parse.ModParseContext, error)

func (*Workspace) GetResource

func (w *Workspace) GetResource(parsedName *modconfig.ParsedResourceName) (resource modconfig.HclResource, found bool)

func (*Workspace) LoadExclusions added in v1.7.0

func (w *Workspace) LoadExclusions() error

func (*Workspace) LoadLock added in v1.7.0

func (w *Workspace) LoadLock()

func (*Workspace) LoadUnlock added in v1.7.0

func (w *Workspace) LoadUnlock()

func (*Workspace) LoadWorkspaceMod added in v1.7.0

func (w *Workspace) LoadWorkspaceMod(ctx context.Context) error_helpers.ErrorAndWarnings

func (*Workspace) ModfileExists

func (w *Workspace) ModfileExists() bool

func (*Workspace) ReloadModResources added in v1.7.0

func (*Workspace) SetModfileExists added in v1.7.0

func (w *Workspace) SetModfileExists()

check whether the workspace contains a modfile this will determine whether we load files recursively, and create pseudo resources for sql files

func (*Workspace) SetOnFileWatcherEventMessages

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

func (*Workspace) SetupWatcher

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

Jump to

Keyboard shortcuts

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