Documentation
¶
Index ¶
- Constants
- Variables
- func IsDevVersion() bool
- func IsNonProdVersion() bool
- func IsReservedLongFlag(long string) bool
- func IsReservedShortFlag(short string) bool
- func UserAgent() string
- type AzdVersionInfo
- type EnvFlag
- type ErrorWithSuggestion
- type ErrorWithTraceId
- type GlobalCommandOptions
- type ReservedFlag
Constants ¶
const ( VsCodeAgentPrefix = "vscode:/extensions/ms-azuretools.azure-dev" // cspell: disable-next-line VsAgentPrefix = "vside:/webtools/azdev.publish" // cspell: disable-next-line VsCodeAzureCopilotAgentPrefix = "ms-azuretools.vscode-azure-github-copilot" )
Well-known user agents prefixes.
const AzdUserAgentEnvVar = "AZURE_DEV_USER_AGENT"
Environment variable that identifies a user agent calling into azd. Any caller of azd can set this variable to identify themselves.
const EnvironmentNameFlagName string = "environment"
EnvironmentNameFlagName is the full name of the flag as it appears on the command line.
Variables ¶
var ( ErrNoEnvironmentsFound = errors.New("no environments found") ErrKeyNotFound = errors.New("key not found in environment values") ErrNoKeyNameProvided = errors.New("no key name provided") ErrNoEnvValuesProvided = errors.New("no environment values provided") ErrInvalidFlagCombination = errors.New("invalid flag combination") )
Environment command errors
var ( ErrInfraNotProvisioned = errors.New("infrastructure has not been provisioned") ErrFromPackageWithAll = errors.New("'--from-package' cannot be specified when '--all' is set") ErrFromPackageNoService = errors.New( "'--from-package' cannot be specified when deploying all services") )
Deploy command errors
var ( ErrCannotChangeSubscription = errors.New("cannot change subscription for existing environment") ErrCannotChangeLocation = errors.New("cannot change location for existing environment") ErrPreviewMultipleLayers = errors.New("--preview cannot be used when provisioning multiple layers") )
Provision command errors
var ( ErrBranchRequiresTemplate = errors.New( "using branch argument requires a template argument to be specified") ErrMultipleInitModes = errors.New( "only one of init modes: --template, --from-code, or --minimal should be set") )
Init command errors
var ( ErrNoArgsProvided = errors.New("required arguments not provided") ErrInvalidArgValue = errors.New("invalid argument value") ErrOperationCancelled = errors.New("operation cancelled by user") // ErrAbortedByUser indicates the user intentionally declined to proceed (e.g. preflight warnings). // This is not a failure — the CLI should exit with code 0. ErrAbortedByUser = errors.New("operation aborted by user") )
Argument/flag validation errors
var ( ErrExtensionNotFound = errors.New("extension not found") ErrNoExtensionsAvailable = errors.New("no extensions available for operation") ErrExtensionTokenFailed = errors.New("failed to generate extension token") )
Extension errors
var ( ErrServiceNotFound = errors.New("service not found in project") ErrResourceNotConfigured = errors.New("required resource not configured") )
Service/resource errors
var (
ErrConfigKeyNotFound = errors.New("config key not found")
)
Config errors
var (
ErrLoginDisabledDelegatedMode = errors.New(
"'azd auth login' is disabled when the auth mode is delegated")
)
Auth command errors
var (
ErrMcpToolsLoadFailed = errors.New("failed to load MCP host tools")
)
MCP errors
var (
ErrUnsupportedOperation = errors.New("operation not supported")
)
Unsupported operation errors
var (
ErrValidationFailed = errors.New("validation failed")
)
Validation errors
var Version = devVersionString
The version string, as printed by `azd version`.
This MUST be of the form "<semver> (commit <full commit hash>)"
The default value here is used for a version built directly by a developer when running either `go install` or `go build` without overriding the value at link time (the default behavior when build or install are run without arguments).
Official builds set this value based on the version and commit we are building, using `-ldflags`
Example:
-ldflags="-X 'github.com/azure/azure-dev/cli/azd/internal.Version=0.0.1-alpha.1 (commit 8a49ae5ae9ab13beeade35f91ad4b4611c2f5574)'"
This value is exported and not const so it can be mutated by certain tests. Instead of accessing this member directly, use VersionInfo which returns a structured version of this value.
nolint: lll
Functions ¶
func IsDevVersion ¶
func IsDevVersion() bool
func IsNonProdVersion ¶
func IsNonProdVersion() bool
func IsReservedLongFlag ¶ added in v1.24.0
IsReservedLongFlag returns true when the given long flag name (without the leading "--") is reserved by azd as a global flag.
func IsReservedShortFlag ¶ added in v1.24.0
IsReservedShortFlag returns true when the given single-character flag name (without the leading "-") is reserved by azd as a global flag.
Types ¶
type AzdVersionInfo ¶
func VersionInfo ¶
func VersionInfo() AzdVersionInfo
type EnvFlag ¶
type EnvFlag struct {
EnvironmentName string
// contains filtered or unexported fields
}
EnvFlag is a flag that represents the environment name. Actions which inject an environment should also use this flag so the user can control what environment is loaded in a uniform way across all our commands.
type ErrorWithSuggestion ¶
type ErrorWithSuggestion = errorhandler.ErrorWithSuggestion
ErrorWithSuggestion is a type alias for errorhandler.ErrorWithSuggestion. The canonical type lives in pkg/errorhandler so it can be used by extensions.
type ErrorWithTraceId ¶
ErrorWithTraceId is a custom error type that includes a trace ID for the current operation
func (*ErrorWithTraceId) Error ¶
func (et *ErrorWithTraceId) Error() string
Error returns the error message
func (*ErrorWithTraceId) Unwrap ¶
func (et *ErrorWithTraceId) Unwrap() error
Unwrap returns the wrapped error
type GlobalCommandOptions ¶
type GlobalCommandOptions struct {
// Cwd allows the user to override the current working directory, temporarily.
// The root command will take care of cd'ing into that folder before your command
// and cd'ing back to the original folder after the commands complete (to make testing
// easier)
Cwd string
// EnableDebugLogging indicates you should turn on verbose/debug logging in your command any
// launched tools. It's enabled with `--debug`, for any command.
EnableDebugLogging bool
// NoPrompt controls non-interactive mode. When true, interactive prompts should behave as
// if the user selected the default value. If there is no default value the prompt returns
// an error.
//
// Can be enabled via:
// - --no-prompt flag
// - --non-interactive flag (alias for --no-prompt)
// - AZD_NON_INTERACTIVE=true environment variable
// - Automatic agent detection (lowest priority)
NoPrompt bool
// EnvironmentName holds the value of `-e/--environment` parsed from the command line
// before Cobra command tree construction. For extension commands (which use
// DisableFlagParsing), this is the only reliable way to know what `-e` value
// the user specified. It is empty when the user did not pass `-e` or when the
// value was not a valid environment name (extensions may reuse `-e` for other
// purposes such as URLs).
EnvironmentName string
// EnableTelemetry indicates if telemetry should be sent.
// The rootCmd will disable this based if the environment variable
// AZURE_DEV_COLLECT_TELEMETRY is set to 'no'.
// Defaults to true.
EnableTelemetry bool
// Generates platform-agnostic help for use on static documentation sites
// like learn.microsoft.com. This is set directly when calling NewRootCmd
// and not bound to any command flags.
GenerateStaticHelp bool
}
type ReservedFlag ¶ added in v1.24.0
type ReservedFlag struct {
// Long is the full flag name (e.g. "environment"). Always present.
Long string
// Short is the single-character alias (e.g. "e"). Empty when there is no short form.
Short string
// Description explains the flag's purpose in azd.
Description string
}
ReservedFlag describes a global flag that is owned by azd and must not be reused by extensions for a different purpose. Extensions that register a flag with the same short or long name will shadow the global flag, causing unpredictable behavior when azd tries to parse the command line before dispatching to the extension.
func GetReservedLongFlag ¶ added in v1.24.0
func GetReservedLongFlag(long string) (ReservedFlag, bool)
GetReservedLongFlag returns the ReservedFlag for the given long name, if any.
func GetReservedShortFlag ¶ added in v1.24.0
func GetReservedShortFlag(short string) (ReservedFlag, bool)
GetReservedShortFlag returns the ReservedFlag for the given short name, if any.
func ReservedFlags ¶ added in v1.24.0
func ReservedFlags() []ReservedFlag
ReservedFlags returns a copy of the reserved flags list. The copy prevents callers from mutating the canonical list.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package appdetect allows for detection of application projects.
|
Package appdetect allows for detection of application projects. |
|
Package mapper provides a reflection-based type conversion framework.
|
Package mapper provides a reflection-based type conversion framework. |
|
Package repository provides handling of files in the user's code repository.
|
Package repository provides handling of files in the user's code repository. |
|
agentdetect
Package agentdetect provides functionality to detect when azd is invoked by known AI coding agents (Claude Code, GitHub Copilot, Gemini, OpenCode) and enables automatic adjustment of behavior (e.g., no-prompt mode).
|
Package agentdetect provides functionality to detect when azd is invoked by known AI coding agents (Claude Code, GitHub Copilot, Gemini, OpenCode) and enables automatic adjustment of behavior (e.g., no-prompt mode). |
|
Package telemetry provides functionality for emitting telemetry in azd.
|
Package telemetry provides functionality for emitting telemetry in azd. |
|
baggage
Package baggage provides an implementation of storing trace-level context data, i.e.
|
Package baggage provides an implementation of storing trace-level context data, i.e. |
|
events
Package events provides definitions and functions related to the definition of telemetry events.
|
Package events provides definitions and functions related to the definition of telemetry events. |
|
fields
Package fields provides definitions and functions related to the definition of telemetry fields.
|
Package fields provides definitions and functions related to the definition of telemetry fields. |
|
resource
Package resource provides application-level resource attributes for telemetry purposes.
|
Package resource provides application-level resource attributes for telemetry purposes. |
|
Package vsrpc provides the RPC server that Visual Studio uses to interact with azd programmatically.
|
Package vsrpc provides the RPC server that Visual Studio uses to interact with azd programmatically. |