middleware

package
v1.23.14 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 57 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDebuggerAborted = errors.New("debugger attach aborted")

ErrDebuggerAborted is returned when the user declines to attach a debugger.

Functions

func IsChildAction

func IsChildAction(ctx context.Context) bool

IsChildAction checks if the given context was created by WithChildAction. This is used to determine if a command is being executed as part of a workflow step.

func WithChildAction

func WithChildAction(ctx context.Context) context.Context

Types

type CurrentUserAuthManager

type CurrentUserAuthManager interface {
	Cloud() *cloud.Cloud
	Mode() (auth.AuthSource, error)
	CredentialForCurrentUser(
		ctx context.Context,
		options *auth.CredentialForCurrentUserOptions,
	) (azcore.TokenCredential, error)
}

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 ErrorMiddleware

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

func (*ErrorMiddleware) Run

type ExperimentationMiddleware

type ExperimentationMiddleware struct {
}

func (*ExperimentationMiddleware) Run

type ExtensionsMiddleware

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

func (*ExtensionsMiddleware) Run

type HooksMiddleware

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

func (*HooksMiddleware) Run

Runs the Hooks middleware

type LoginGuardMiddleware

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

LoginGuardMiddleware ensures that the user is logged in otherwise it returns an error

func (*LoginGuardMiddleware) Run

Run ensures that the user is logged in otherwise it returns an error

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 NewErrorMiddleware

func NewErrorMiddleware(
	options *Options, console input.Console,
	agentFactory agent.AgentFactory,
	global *internal.GlobalCommandOptions,
	featuresManager *alpha.FeatureManager,
	userConfigManager config.UserConfigManager,
	errorPipeline *errorhandler.ErrorHandlerPipeline,
) Middleware

func NewExperimentationMiddleware

func NewExperimentationMiddleware() Middleware

func NewExtensionsMiddleware

func NewExtensionsMiddleware(
	options *Options,
	serviceLocator ioc.ServiceLocator,
	extensionsManager *extensions.Manager,
	extensionRunner *extensions.Runner,
	console input.Console,
	globalOptions *internal.GlobalCommandOptions,
) Middleware

func NewHooksMiddleware

func NewHooksMiddleware(
	envManager environment.Manager,
	env *environment.Environment,
	projectConfig *project.ProjectConfig,
	importManager *project.ImportManager,
	commandRunner exec.CommandRunner,
	console input.Console,
	options *Options,
	serviceLocator ioc.ServiceLocator,
) Middleware

Creates a new instance of the Hooks middleware

func NewLoginGuardMiddleware

func NewLoginGuardMiddleware(
	console input.Console,
	authManager CurrentUserAuthManager,
	workflowRunner *workflow.Runner) Middleware

NewLoginGuardMiddleware creates a new instance of the LoginGuardMiddleware

func NewTelemetryMiddleware

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

Creates a new Telemetry middleware instance

func NewUxMiddleware

func NewUxMiddleware(options *Options, console input.Console, featuresManager *alpha.FeatureManager) 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
	Annotations map[string]string
	// contains filtered or unexported fields
}

Middleware Run options

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