echo

package
v2.31.9 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: AGPL-3.0 Imports: 16 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{},
		},
	}}
	// InitComplete is a helper to indicate an empty init completion.
	InitComplete = []*proto.Response{{
		Type: &proto.Response_Init{
			Init: &proto.InitComplete{
				ModuleFiles: []byte{},
			},
		},
	}}
	// PlanComplete is a helper to indicate an empty provision completion.
	PlanComplete = []*proto.Response{{
		Type: &proto.Response_Plan{
			Plan: &proto.PlanComplete{
				Plan: []byte("{}"),
			},
		},
	}}
	// ApplyComplete is a helper to indicate an empty provision completion.
	ApplyComplete = []*proto.Response{{
		Type: &proto.Response_Apply{
			Apply: &proto.ApplyComplete{},
		},
	}}
	GraphComplete = []*proto.Response{{
		Type: &proto.Response_Graph{
			Graph: &proto.GraphComplete{},
		},
	}}

	InitFailed = []*proto.Response{{
		Type: &proto.Response_Init{
			Init: &proto.InitComplete{
				Error: "failed!",
			},
		},
	}}
	// 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!",
			},
		},
	}}
	GraphFailed = []*proto.Response{{
		Type: &proto.Response_Graph{
			Graph: &proto.GraphComplete{
				Error: "failed!",
			},
		},
	}}
)

Functions

func ParameterTerraform added in v2.25.0

func ParameterTerraform(param *proto.RichParameter) (string, error)

ParameterTerraform will create a Terraform data block for the provided parameter.

func ProvisionGraphWithAgent added in v2.30.0

func ProvisionGraphWithAgent(authToken string, muts ...func(g *proto.GraphComplete)) []*proto.Response

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

func ProvisionGraphWithAgentAndAPIKeyScope added in v2.30.0

func ProvisionGraphWithAgentAndAPIKeyScope(authToken string, apiKeyScope string) []*proto.Response

ProvisionGraphWithAgentAndAPIKeyScope 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

	// Used to mock ALL responses regardless of transition.
	ProvisionInit  []*proto.Response
	ProvisionPlan  []*proto.Response
	ProvisionApply []*proto.Response
	ProvisionGraph []*proto.Response

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

	ExtraFiles map[string][]byte
}

Responses is a collection of mocked responses to Provision operations.

func WithExtraFiles added in v2.22.0

func WithExtraFiles(extraFiles map[string][]byte) *Responses

func WithResources added in v2.1.4

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

func (*Responses) Valid added in v2.30.0

func (r *Responses) Valid() error

Jump to

Keyboard shortcuts

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