exec

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecCanceledError

func ExecCanceledError(method string) *execCanceledErr

func ExecTimeoutError

func ExecTimeoutError(method string, duration time.Duration) *execTimeoutErr

func WithExecutorFactory added in v0.13.0

func WithExecutorFactory(ctx context.Context, f ExecutorFactory) context.Context

func WithExecutorOpts added in v0.13.0

func WithExecutorOpts(ctx context.Context, opts *ExecutorOpts) context.Context

Types

type Executor

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

func (*Executor) Format added in v0.2.0

func (e *Executor) Format(ctx context.Context, input []byte) ([]byte, error)

func (*Executor) Get added in v0.20.0

func (e *Executor) Get(ctx context.Context, opts ...tfexec.GetCmdOption) error

func (*Executor) GetExecPath

func (e *Executor) GetExecPath() string

func (*Executor) Init added in v0.11.0

func (e *Executor) Init(ctx context.Context, opts ...tfexec.InitOption) error

func (*Executor) ProviderSchemas

func (e *Executor) ProviderSchemas(ctx context.Context) (*tfjson.ProviderSchemas, error)

func (*Executor) SetExecLogPath

func (e *Executor) SetExecLogPath(rawPath string) error

func (*Executor) SetLogger

func (e *Executor) SetLogger(logger *log.Logger)

func (*Executor) SetTimeout

func (e *Executor) SetTimeout(duration time.Duration)

func (*Executor) Validate added in v0.11.0

func (e *Executor) Validate(ctx context.Context) ([]tfjson.Diagnostic, error)

func (*Executor) Version

func (e *Executor) Version(ctx context.Context) (*version.Version, map[string]*version.Version, error)

type ExecutorFactory added in v0.4.0

type ExecutorFactory func(workDir, execPath string) (TerraformExecutor, error)

ExecutorFactory can be used in external consumers of exec pkg to enable easy swapping with MockExecutor

func ExecutorFactoryFromContext added in v0.13.0

func ExecutorFactoryFromContext(ctx context.Context) (ExecutorFactory, bool)

func NewMockExecutor added in v0.8.0

func NewMockExecutor(calls *TerraformMockCalls) ExecutorFactory

type ExecutorOpts added in v0.13.0

type ExecutorOpts struct {
	ExecPath    string
	ExecLogPath string
	Timeout     time.Duration
}

func ExecutorOptsFromContext added in v0.13.0

func ExecutorOptsFromContext(ctx context.Context) (*ExecutorOpts, bool)

type ExitError

type ExitError struct {
	Err    *exec.ExitError
	CtxErr error

	Method string
}

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) Unwrap

func (e *ExitError) Unwrap() error

type Formatter added in v0.5.0

type Formatter func(ctx context.Context, input []byte) ([]byte, error)

type TerraformExecutor added in v0.8.0

type TerraformExecutor interface {
	SetLogger(logger *log.Logger)
	SetExecLogPath(path string) error
	SetTimeout(duration time.Duration)
	GetExecPath() string
	Init(ctx context.Context, opts ...tfexec.InitOption) error
	Get(ctx context.Context, opts ...tfexec.GetCmdOption) error
	Format(ctx context.Context, input []byte) ([]byte, error)
	Version(ctx context.Context) (*version.Version, map[string]*version.Version, error)
	Validate(ctx context.Context) ([]tfjson.Diagnostic, error)
	ProviderSchemas(ctx context.Context) (*tfjson.ProviderSchemas, error)
}

func NewExecutor

func NewExecutor(workDir, execPath string) (TerraformExecutor, error)

type TerraformMockCalls added in v0.13.0

type TerraformMockCalls struct {
	PerWorkDir map[string][]*mock.Call
	AnyWorkDir []*mock.Call
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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