rootmodule

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIgnoredFile added in v0.9.0

func IsIgnoredFile(name string) bool

IsIgnoredFile returns true if the given filename (which must not have a directory path ahead of it) should be ignored as e.g. an editor swap file.

func IsRootModuleNotFound

func IsRootModuleNotFound(err error) bool

func NewRootModuleMock

func NewRootModuleMock(rmm *RootModuleMock, fs filesystem.Filesystem, dir string) *rootModule

func ParseModuleManifestFromFile

func ParseModuleManifestFromFile(path string) (*moduleManifest, error)

Types

type File

type File interface {
	Path() string
}

type ModuleRecord

type ModuleRecord struct {
	// Key is a unique identifier for this particular module, based on its
	// position within the static module tree.
	Key string `json:"Key"`

	// SourceAddr is the source address given for this module in configuration.
	// This is used only to detect if the source was changed in configuration
	// since the module was last installed, which means that the installer
	// must re-install it.
	SourceAddr string `json:"Source"`

	// Version is the exact version of the module, which results from parsing
	// VersionStr. nil for un-versioned modules.
	Version *version.Version `json:"-"`

	// VersionStr is the version specifier string. This is used only for
	// serialization in snapshots and should not be accessed or updated
	// by any other codepaths; use "Version" instead.
	VersionStr string `json:"Version,omitempty"`

	// Dir is the path to the local directory where the module is installed.
	Dir string `json:"Dir"`
}

ModuleRecord represents some metadata about an installed module, as part of a ModuleManifest.

func (*ModuleRecord) IsExternal

func (r *ModuleRecord) IsExternal() bool

func (*ModuleRecord) IsRoot

func (r *ModuleRecord) IsRoot() bool

func (*ModuleRecord) UnmarshalJSON

func (r *ModuleRecord) UnmarshalJSON(b []byte) error

type RootModule

type RootModule interface {
	Path() string
	MatchesPath(path string) bool
	LoadError() error
	StartLoading() error
	IsLoadingDone() bool
	LoadingDone() <-chan struct{}
	IsKnownPluginLockFile(path string) bool
	IsKnownModuleManifestFile(path string) bool
	PathsToWatch() []string
	UpdateProviderSchemaCache(ctx context.Context, lockFile File) error
	IsProviderSchemaLoaded() bool
	UpdateModuleManifest(manifestFile File) error
	Decoder() (*decoder.Decoder, error)
	DecoderWithSchema(*schema.BodySchema) (*decoder.Decoder, error)
	MergedSchema() (*schema.BodySchema, error)
	IsParsed() bool
	ParseFiles() error
	ParsedDiagnostics() map[string]hcl.Diagnostics
	TerraformFormatter() (exec.Formatter, error)
	HasTerraformDiscoveryFinished() bool
	IsTerraformAvailable() bool
	ExecuteTerraformInit(ctx context.Context) error
	ExecuteTerraformValidate(ctx context.Context) (map[string]hcl.Diagnostics, error)
	Modules() []ModuleRecord
	HumanReadablePath(string) string
	WasInitialized() (bool, error)
}

func NewRootModule

func NewRootModule(ctx context.Context, fs filesystem.Filesystem, dir string) (RootModule, error)

type RootModuleFactory

type RootModuleFactory func(context.Context, string) (*rootModule, error)

type RootModuleFinder added in v0.9.0

type RootModuleFinder interface {
	RootModuleCandidatesByPath(path string) RootModules
	RootModuleByPath(path string) (RootModule, error)
	SchemaForPath(path string) (*schema.BodySchema, error)
}

type RootModuleLoader added in v0.5.0

type RootModuleLoader func(dir string) (RootModule, error)

func NewRootModuleLoader added in v0.5.0

func NewRootModuleLoader(ctx context.Context, rmm RootModuleManager) RootModuleLoader

NewRootModuleLoader allows adding & loading root modules with a given context. This can be passed down to any handler which itself will have short-lived context therefore couldn't finish loading the root module asynchronously after it responds to the client

type RootModuleManager

type RootModuleManager interface {
	RootModuleFinder
	TerraformFormatterFinder

	SetLogger(logger *log.Logger)

	SetTerraformExecPath(path string)
	SetTerraformExecLogPath(logPath string)
	SetTerraformExecTimeout(timeout time.Duration)

	InitAndUpdateRootModule(ctx context.Context, dir string) (RootModule, error)
	AddAndStartLoadingRootModule(ctx context.Context, dir string) (RootModule, error)
	WorkerPoolSize() int
	WorkerQueueSize() int
	ListRootModules() RootModules
	PathsToWatch() []string
	CancelLoading()
}

func NewRootModuleManager

func NewRootModuleManager(fs filesystem.Filesystem) RootModuleManager

type RootModuleManagerFactory

type RootModuleManagerFactory func(filesystem.Filesystem) RootModuleManager

type RootModuleManagerMockInput added in v0.5.0

type RootModuleManagerMockInput struct {
	RootModules       map[string]*RootModuleMock
	TfExecutorFactory exec.ExecutorFactory
}

type RootModuleMock

type RootModuleMock struct {
	TfExecFactory   exec.ExecutorFactory
	ProviderSchemas *tfjson.ProviderSchemas
}

type RootModuleMockFactory

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

func (*RootModuleMockFactory) New

func (rmf *RootModuleMockFactory) New(ctx context.Context, dir string) (*rootModule, error)

type RootModuleNotFoundErr

type RootModuleNotFoundErr struct {
	Dir string
}

func (*RootModuleNotFoundErr) Error

func (e *RootModuleNotFoundErr) Error() string

type RootModules added in v0.5.0

type RootModules []RootModule

func (RootModules) Paths added in v0.5.0

func (rms RootModules) Paths() []string

type TerraformFormatterFinder added in v0.5.0

type TerraformFormatterFinder interface {
	TerraformFormatterForDir(ctx context.Context, path string) (exec.Formatter, error)
	HasTerraformDiscoveryFinished(path string) (bool, error)
	IsTerraformAvailable(path string) (bool, error)
}

type WalkFunc

type WalkFunc func(ctx context.Context, rootModulePath string) error

type Walker

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

func MockWalker added in v0.5.0

func MockWalker() *Walker

func NewWalker

func NewWalker() *Walker

func (*Walker) Done added in v0.6.0

func (w *Walker) Done() <-chan struct{}

func (*Walker) IsWalking added in v0.5.0

func (w *Walker) IsWalking() bool

func (*Walker) SetExcludeModulePaths added in v0.6.0

func (w *Walker) SetExcludeModulePaths(excludeModulePaths []string)

func (*Walker) SetLogger

func (w *Walker) SetLogger(logger *log.Logger)

func (*Walker) StartWalking added in v0.5.0

func (w *Walker) StartWalking(ctx context.Context, path string, wf WalkFunc) error

func (*Walker) Stop added in v0.5.0

func (w *Walker) Stop()

type WalkerFactory added in v0.5.0

type WalkerFactory func() *Walker

Jump to

Keyboard shortcuts

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