middleware

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 60 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 NewToolFirstRunMiddleware added in v1.25.0

func NewToolFirstRunMiddleware(
	alphaManager *alpha.FeatureManager,
	configManager config.UserConfigManager,
	console input.Console,
	manager *tool.Manager,
	options *internal.GlobalCommandOptions,
) Middleware

NewToolFirstRunMiddleware creates a new ToolFirstRunMiddleware.

func NewToolUpdateCheckMiddleware added in v1.25.0

func NewToolUpdateCheckMiddleware(
	alphaManager *alpha.FeatureManager,
	manager *tool.Manager,
	console input.Console,
	options *Options,
	globalOptions *internal.GlobalCommandOptions,
) Middleware

NewToolUpdateCheckMiddleware creates a new ToolUpdateCheckMiddleware. All dependencies are resolved by the IoC container.

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 ToolFirstRunMiddleware added in v1.25.0

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

ToolFirstRunMiddleware presents a one-time welcome experience on the very first invocation of azd. It detects the user's installed Azure development tools and optionally offers to install any missing recommended tools.

func (*ToolFirstRunMiddleware) Run added in v1.25.0

Run executes the first-run experience if it has not been completed yet. Regardless of whether the experience runs, the middleware always delegates to nextFn so the user's intended command is never blocked.

type ToolUpdateCheckMiddleware added in v1.25.0

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

ToolUpdateCheckMiddleware periodically checks for tool updates in the background and displays cached update notifications before command execution. Notifications are only shown when the console is interactive and the current command is not a tool-management subcommand.

func (*ToolUpdateCheckMiddleware) Run added in v1.25.0

Run executes the tool update check middleware. Before the command runs it displays any cached update notifications. After the command completes it triggers a background update check when the configured check interval has elapsed.

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