echo

package
v2.24.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 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{
				Plan:        []byte("{}"),
				ModuleFiles: []byte{},
			},
		},
	}}
	// 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 ProvisionApplyWithAgentAndAPIKeyScope added in v2.22.0

func ProvisionApplyWithAgentAndAPIKeyScope(authToken string, apiKeyScope 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

	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

Jump to

Keyboard shortcuts

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

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy