middleware

package
v0.0.0-...-aadbc26 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithChildAction

func WithChildAction(ctx context.Context) context.Context

Types

type DebugMiddleware

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

Adds support to easily debug and attach a debugger to AZD for development purposes

func (*DebugMiddleware) Run

Invokes the debug middleware. When AZD_DEBUG is set will prompt the user to attach a debugger before continuing invocation of the action

type ExperimentationMiddleware

type ExperimentationMiddleware struct {
}

func (*ExperimentationMiddleware) Run

type HooksMiddleware

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

func (*HooksMiddleware) Run

Runs the Hooks middleware

type Middleware

type Middleware interface {
	Run(ctx context.Context, nextFn NextFn) (*actions.ActionResult, error)
}

Defines a middleware component

func NewDebugMiddleware

func NewDebugMiddleware(options *Options, console input.Console) Middleware

Creates a new instance of the Debug middleware

func NewExperimentationMiddleware

func NewExperimentationMiddleware() Middleware

func NewHooksMiddleware

func NewHooksMiddleware(
	lazyEnvManager *lazy.Lazy[environment.Manager],
	lazyEnv *lazy.Lazy[*environment.Environment],
	lazyProjectConfig *lazy.Lazy[*project.ProjectConfig],
	importManager *project.ImportManager,
	commandRunner exec.CommandRunner,
	console input.Console,
	options *Options,
) Middleware

Creates a new instance of the Hooks middleware

func NewTelemetryMiddleware

func NewTelemetryMiddleware(options *Options, lazyPlatformConfig *lazy.Lazy[*platform.Config]) Middleware

Creates a new Telemetry middleware instance

func NewUxMiddleware

func NewUxMiddleware(options *Options, console input.Console) Middleware

type MiddlewareRunner

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

Middleware runner stores middleware registrations and orchestrates the invocation of middleware components and actions.

func NewMiddlewareRunner

func NewMiddlewareRunner(container *ioc.NestedContainer) *MiddlewareRunner

Creates a new middleware runner

func (*MiddlewareRunner) RunAction

func (r *MiddlewareRunner) RunAction(
	ctx context.Context,
	runOptions *Options,
	actionName string,
) (*actions.ActionResult, error)

Executes the middleware chain for the specified action

func (*MiddlewareRunner) Use

func (r *MiddlewareRunner) Use(name string, resolveFn any) error

Registers middleware components that will be run for all actions

type NextFn

type NextFn func(ctx context.Context) (*actions.ActionResult, error)

Executes the next middleware in the command chain

type Options

type Options struct {
	CommandPath string
	Name        string
	Aliases     []string
	Flags       *pflag.FlagSet
	Args        []string
	// contains filtered or unexported fields
}

Middleware Run options

func (*Options) IsChildAction

func (o *Options) IsChildAction(ctx context.Context) bool

func (*Options) WithContainer

func (o *Options) WithContainer(container *ioc.NestedContainer)

Sets the container to be used for resolving middleware components

type ResolveFn

type ResolveFn func() Middleware

Registration function that returns a constructed middleware

type TelemetryMiddleware

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

Telemetry middleware tracks telemetry for the given action

func (*TelemetryMiddleware) Run

Invokes the middleware and wraps the action with a telemetry span for telemetry reporting

type UxMiddleware

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

func (*UxMiddleware) Run

Jump to

Keyboard shortcuts

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