client

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Set the environment for the client
	SetEnv(map[string]string) error

	// Set the standard out for the client
	SetStdout(w io.Writer)

	// Init initializes the client and environment
	Init(ctx context.Context) error

	// Apply makes a request to apply changes
	Apply(ctx context.Context) error

	// Plan makes a request to generate a plan of proposed changes
	Plan(ctx context.Context) (bool, error)

	// Validate verifies that the generated configurations are valid
	Validate(ctx context.Context) error

	// GoString defines the printable version of the client
	GoString() string
}

Client describes the interface for a driver's client that interacts with network infrastructure.

type Printer

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

Printer is a fake client that only logs out actions. Intended to mirror TerraformCLI client and to be used for development only

func NewPrinter

func NewPrinter(config *PrinterConfig) (*Printer, error)

NewPrinter creates a new client

func (*Printer) Apply

func (p *Printer) Apply(ctx context.Context) error

Apply logs out 'apply'

func (*Printer) GoString

func (p *Printer) GoString() string

GoString defines the printable version of this struct.

func (*Printer) Init

func (p *Printer) Init(ctx context.Context) error

Init logs out 'init'

func (*Printer) Plan

func (p *Printer) Plan(ctx context.Context) (bool, error)

Plan logs out 'plan'

func (*Printer) SetEnv

func (p *Printer) SetEnv(map[string]string) error

SetEnv logs out 'setenv'

func (*Printer) SetStdout

func (p *Printer) SetStdout(w io.Writer)

SetStdout logs out 'set standard out'

func (*Printer) Validate added in v0.2.0

func (p *Printer) Validate(ctx context.Context) error

Validate logs out 'validate'

type PrinterConfig

type PrinterConfig struct {
	LogLevel   string
	ExecPath   string
	WorkingDir string
	Workspace  string
}

PrinterConfig configures the log client

type TerraformCLI

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

TerraformCLI is the client that wraps around terraform-exec to execute Terraform cli commands

func NewTerraformCLI

func NewTerraformCLI(config *TerraformCLIConfig) (*TerraformCLI, error)

NewTerraformCLI creates a terraform-exec client and configures and initializes a new Terraform client

func (*TerraformCLI) Apply

func (t *TerraformCLI) Apply(ctx context.Context) error

Apply executes the cli command `terraform apply` for a given workspace

func (*TerraformCLI) GoString

func (t *TerraformCLI) GoString() string

GoString defines the printable version of this struct.

func (*TerraformCLI) Init

func (t *TerraformCLI) Init(ctx context.Context) error

Init initializes by executing the cli command `terraform init` and `terraform workspace new <name>`

func (*TerraformCLI) Plan

func (t *TerraformCLI) Plan(ctx context.Context) (bool, error)

Plan executes the cli command `terraform plan` for a given workspace

func (*TerraformCLI) SetEnv

func (t *TerraformCLI) SetEnv(env map[string]string) error

SetEnv sets the environment for the Terraform workspace

func (*TerraformCLI) SetStdout

func (t *TerraformCLI) SetStdout(w io.Writer)

SetStdout sets the standard out for Terraform

func (*TerraformCLI) Validate added in v0.2.0

func (t *TerraformCLI) Validate(ctx context.Context) error

Validate verifies the generated configuration files

type TerraformCLIConfig

type TerraformCLIConfig struct {
	Log        bool
	PersistLog bool
	ExecPath   string
	WorkingDir string
	Workspace  string
	VarFiles   []string
}

TerraformCLIConfig configures the Terraform client

Jump to

Keyboard shortcuts

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