echo

package
v2.10.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ParseComplete is a helper to indicate an empty parse completion.
	ParseComplete = []*proto.Response{{
		Type: &proto.Response_Parse{
			Parse: &proto.ParseComplete{},
		},
	}}
	// PlanComplete is a helper to indicate an empty provision completion.
	PlanComplete = []*proto.Response{{
		Type: &proto.Response_Plan{
			Plan: &proto.PlanComplete{},
		},
	}}
	// ApplyComplete is a helper to indicate an empty provision completion.
	ApplyComplete = []*proto.Response{{
		Type: &proto.Response_Apply{
			Apply: &proto.ApplyComplete{},
		},
	}}

	// PlanFailed is a helper to convey a failed plan operation
	PlanFailed = []*proto.Response{{
		Type: &proto.Response_Plan{
			Plan: &proto.PlanComplete{
				Error: "failed!",
			},
		},
	}}
	// ApplyFailed is a helper to convey a failed apply operation
	ApplyFailed = []*proto.Response{{
		Type: &proto.Response_Apply{
			Apply: &proto.ApplyComplete{
				Error: "failed!",
			},
		},
	}}
)

Functions

func ProvisionApplyWithAgent

func ProvisionApplyWithAgent(authToken string) []*proto.Response

ProvisionApplyWithAgent returns provision responses that will mock a fake "aws_instance" resource with an agent that has the given auth token.

func Serve

func Serve(ctx context.Context, options *provisionersdk.ServeOptions) error

Serve starts the echo provisioner.

func Tar

func Tar(responses *Responses) ([]byte, error)

Tar returns a tar archive of responses to provisioner operations.

func TarWithOptions added in v2.4.0

func TarWithOptions(ctx context.Context, logger slog.Logger, responses *Responses) ([]byte, error)

TarWithOptions returns a tar archive of responses to provisioner operations, but it gives more insight into the archiving process.

Types

type Responses

type Responses struct {
	Parse []*proto.Response

	// ProvisionApply and ProvisionPlan are used to mock ALL responses of
	// Apply and Plan, regardless of transition.
	ProvisionApply []*proto.Response
	ProvisionPlan  []*proto.Response

	// ProvisionApplyMap and ProvisionPlanMap are used to mock specific
	// transition responses. They are prioritized over the generic responses.
	ProvisionApplyMap map[proto.WorkspaceTransition][]*proto.Response
	ProvisionPlanMap  map[proto.WorkspaceTransition][]*proto.Response
}

Responses is a collection of mocked responses to Provision operations.

func WithResources added in v2.1.4

func WithResources(resources []*proto.Resource) *Responses

Jump to

Keyboard shortcuts

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