project

package
v0.0.0-...-8825cfc Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 94 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AiHubNameEnvVarName is the environment variable name for the Azure AI Hub name
	AiHubNameEnvVarName = "AZUREAI_HUB_NAME"
	// AiProjectNameEnvVarName is the environment variable name for the Azure AI project name
	AiProjectNameEnvVarName = "AZUREAI_PROJECT_NAME"
	/* #nosec G101 - Potential hardcoded credentials - false positive */
	// AiEnvironmentEnvVarName is the environment variable name for the Azure AI environment name
	AiEnvironmentEnvVarName = "AZUREAI_ENVIRONMENT_NAME"
	// AiModelEnvVarName is the environment variable name for the Azure AI model name
	AiModelEnvVarName = "AZUREAI_MODEL_NAME"
	// AiEndpointEnvVarName is the environment variable name for the Azure AI endpoint name
	AiEndpointEnvVarName = "AZUREAI_ENDPOINT_NAME"
	// AiDeploymentEnvVarName is the environment variable name for the Azure AI deployment name
	AiDeploymentEnvVarName = "AZUREAI_DEPLOYMENT_NAME"
	// AiFlowEnvVarName is the environment variable name for the Azure AI flow name
	AiFlowEnvVarName = "AZUREAI_FLOW_NAME"
)
View Source
const (
	ProjectEventProvision ext.Event = "provision"
	ProjectEventRestore   ext.Event = "restore"
	ProjectEventBuild     ext.Event = "build"
	ProjectEventPackage   ext.Event = "package"
	ProjectEventPublish   ext.Event = "publish"
	ProjectEventDeploy    ext.Event = "deploy"
)
View Source
const (
	ServiceEventEnvUpdated ext.Event = "environment updated"
	ServiceEventRestore    ext.Event = "restore"
	ServiceEventBuild      ext.Event = "build"
	ServiceEventPackage    ext.Event = "package"
	ServiceEventPublish    ext.Event = "publish"
	ServiceEventDeploy     ext.Event = "deploy"
)
View Source
const AppServiceJavaPackageName = "app"

The default, conventional App Service Java package name

View Source
const DefaultBuilderImage = "mcr.microsoft.com/oryx/builder:debian-bullseye-20240424.1"

Default builder image to produce container images from source, needn't java jdk storage, use the standard bp

View Source
const DefaultStaticWebAppEnvironmentName = "default"

TODO: Enhance for multi-environment support https://github.com/Azure/azure-dev/issues/1152

Variables

View Source
var (
	ProjectEvents []ext.Event = []ext.Event{
		ProjectEventProvision,
		ProjectEventDeploy,
	}
	ErrNoDefaultService = errors.New("no default service selection matches the working directory")
)
View Source
var (
	DefaultProvisioningOptions = provisioning.Options{
		Module: "main",
		Path:   "infra",
	}
)

Functions

func LoadConfig

func LoadConfig(ctx context.Context, projectFilePath string) (config.Config, error)

func OverriddenEndpoints

func OverriddenEndpoints(ctx context.Context, serviceConfig *ServiceConfig, env *environment.Environment) []string

func Save

func Save(ctx context.Context, projectConfig *ProjectConfig, projectFilePath string) error

Saves the current instance back to the azure.yaml file

func SaveConfig

func SaveConfig(ctx context.Context, config config.Config, projectFilePath string) error

Types

type AIModelProps

type AIModelProps struct {
	Model AIModelPropsModel `yaml:"model,omitempty"`
}

type AIModelPropsModel

type AIModelPropsModel struct {
	Name    string `yaml:"name,omitempty"`
	Version string `yaml:"version,omitempty"`
}

type AiFoundryModelProps

type AiFoundryModelProps struct {
	Models []AiServicesModel `yaml:"models,omitempty"`
}

type AiHelper

type AiHelper interface {
	// RequiredExternalTools returns the required external tools for the AiHelper
	RequiredExternalTools(ctx context.Context) []tools.ExternalTool
	// Initialize initializes the AiHelper
	Initialize(ctx context.Context) error
	// ValidateWorkspace ensures that the workspace exists
	ValidateWorkspace(ctx context.Context, scope *ai.Scope) error
	// CreateEnvironmentVersion creates a new environment version
	CreateEnvironmentVersion(
		ctx context.Context,
		scope *ai.Scope,
		serviceConfig *ServiceConfig,
		config *ai.ComponentConfig,
	) (*armmachinelearning.EnvironmentVersion, error)
	// CreateModelVersion creates a new model version
	CreateModelVersion(
		ctx context.Context,
		scope *ai.Scope,
		serviceConfig *ServiceConfig,
		config *ai.ComponentConfig,
	) (*armmachinelearning.ModelVersion, error)
	// GetEndpoint retrieves an online endpoint
	GetEndpoint(ctx context.Context, scope *ai.Scope, endpointName string) (*armmachinelearning.OnlineEndpoint, error)
	// DeployToEndpoint deploys a new online deployment to an online endpoint
	DeployToEndpoint(
		ctx context.Context,
		scope *ai.Scope,
		serviceConfig *ServiceConfig,
		endpointName string,
		config *ai.EndpointDeploymentConfig,
	) (*armmachinelearning.OnlineDeployment, error)
	// DeleteDeployments deletes all deployments of an online endpoint except the ones in filter
	DeleteDeployments(ctx context.Context, scope *ai.Scope, endpointName string, filter []string) error
	// UpdateTraffic updates the traffic distribution of an online endpoint for the specified deployment
	UpdateTraffic(
		ctx context.Context,
		scope *ai.Scope,
		endpointName string,
		deploymentName string,
	) (*armmachinelearning.OnlineEndpoint, error)
	// CreateFlow creates a new flow
	CreateFlow(
		ctx context.Context,
		scope *ai.Scope,
		serviceConfig *ServiceConfig,
		config *ai.ComponentConfig,
	) (*ai.Flow, error)
}

func NewAiHelper

func NewAiHelper(
	env *environment.Environment,
	clock clock.Clock,
	pythonBridge ai.PythonBridge,
	credentialProvider account.SubscriptionCredentialProvider,
	armClientOptions *arm.ClientOptions,
) AiHelper

NewAiHelper creates a new instance of AiHelper

type AiServicesModel

type AiServicesModel struct {
	Name    string             `yaml:"name,omitempty"`
	Version string             `yaml:"version,omitempty"`
	Format  string             `yaml:"format,omitempty"`
	Sku     AiServicesModelSku `yaml:"sku,omitempty"`
}

type AiServicesModelSku

type AiServicesModelSku struct {
	Name      string `yaml:"name,omitempty"`
	UsageName string `yaml:"usageName,omitempty"`
	Capacity  int32  `yaml:"capacity,omitempty"`
}

type AksDeploymentOptions

type AksDeploymentOptions struct {
	Name string `yaml:"name"`
}

The AKS deployment options

type AksIngressOptions

type AksIngressOptions struct {
	Name         string `yaml:"name"`
	RelativePath string `yaml:"relativePath"`
}

The AKS ingress options

type AksOptions

type AksOptions struct {
	// The namespace used for deploying k8s resources. Defaults to the project name
	Namespace string `yaml:"namespace"`
	// The relative folder path from the service that contains the k8s deployment manifests. Defaults to 'manifests'
	DeploymentPath string `yaml:"deploymentPath"`
	// The services ingress configuration options
	Ingress AksIngressOptions `yaml:"ingress"`
	// The services deployment configuration options
	Deployment AksDeploymentOptions `yaml:"deployment"`
	// The services service configuration options
	Service AksServiceOptions `yaml:"service"`
	// The helm configuration options
	Helm *helm.Config `yaml:"helm"`
	// The kustomize configuration options
	Kustomize *kustomize.Config `yaml:"kustomize"`
}

The AKS configuration options

type AksServiceOptions

type AksServiceOptions struct {
	Name string `yaml:"name"`
}

The AKS service configuration options

type AppServiceProps

type AppServiceProps struct {
	Port           int               `yaml:"port,omitempty"`
	Env            []ServiceEnvVar   `yaml:"env,omitempty"`
	Runtime        AppServiceRuntime `yaml:"runtime,omitempty"`
	StartupCommand string            `yaml:"startupCommand,omitempty"`
}

type AppServiceRuntime

type AppServiceRuntime struct {
	Stack   AppServiceRuntimeStack `yaml:"stack,omitempty"`
	Version string                 `yaml:"version,omitempty"`
}

type AppServiceRuntimeStack

type AppServiceRuntimeStack string
const (
	AppServiceRuntimeStackPython AppServiceRuntimeStack = "python"
	AppServiceRuntimeStackNode   AppServiceRuntimeStack = "node"
)

type Artifact

type Artifact struct {
	Kind         ArtifactKind      `json:"kind"`                   // Required: artifact type
	Location     string            `json:"location,omitempty"`     // Optional: location of the artifact
	LocationKind LocationKind      `json:"locationKind,omitempty"` // Optional: local, remote, or other
	Metadata     map[string]string `json:"metadata,omitempty"`     // Optional: arbitrary key/value pairs
}

Artifact represents a build, package, or deployment artifact with its location and metadata.

func (*Artifact) MarshalJSON

func (a *Artifact) MarshalJSON() ([]byte, error)

MarshalJSON implements the UxItem interface JSON marshaling

func (*Artifact) ToString

func (a *Artifact) ToString(currentIndentation string) string

ToString implements the UxItem interface for display output

type ArtifactCollection

type ArtifactCollection []*Artifact

ArtifactCollection provides typed operations on a collection of artifacts

func (*ArtifactCollection) Add

func (ac *ArtifactCollection) Add(artifacts ...*Artifact) error

Add appends an artifact to the collection with validation

func (ArtifactCollection) Find

func (ac ArtifactCollection) Find(opts ...FindOpts) []*Artifact

Find returns all artifacts matching the specified criteria

func (ArtifactCollection) FindFirst

func (ac ArtifactCollection) FindFirst(opts ...FindOpts) (*Artifact, bool)

FindFirst returns the first artifact matching the specified criteria

func (ArtifactCollection) FindLast

func (ac ArtifactCollection) FindLast(opts ...FindOpts) (*Artifact, bool)

FindLast returns the lsat artifact matching the specified criteria

func (ArtifactCollection) MarshalJSON

func (ac ArtifactCollection) MarshalJSON() ([]byte, error)

MarshalJSON implements the UxItem interface JSON marshaling for ArtifactCollection

func (ArtifactCollection) ToString

func (ac ArtifactCollection) ToString(currentIndentation string) string

ToString implements the UxItem interface for ArtifactCollection display output

type ArtifactKind

type ArtifactKind string

ArtifactKind represents well-known artifact types in the Azure Developer CLI

const (
	// Build and compilation artifacts
	ArtifactKindDirectory ArtifactKind = "directory" // Directory containing project or build artifacts
	ArtifactKindConfig    ArtifactKind = "config"    // Configuration

	// Package artifacts
	ArtifactKindArchive   ArtifactKind = "archive"   // Zip/archive package
	ArtifactKindContainer ArtifactKind = "container" // Docker/container image

	// Service and deployment artifacts
	ArtifactKindEndpoint   ArtifactKind = "endpoint"   // Service endpoint URL
	ArtifactKindDeployment ArtifactKind = "deployment" // Deployment result or endpoint
	ArtifactKindResource   ArtifactKind = "resource"   // Azure Resource
)

type CompositeFrameworkService

type CompositeFrameworkService interface {
	FrameworkService
	SetSource(inner FrameworkService)
}

CompositeFrameworkService is a framework service that requires a nested framework service. An example would be a Docker project that uses another framework services such as NPM or Python as a dependency. This supports local inner-loop as well as release restore & package support.

func NewDockerProject

func NewDockerProject(
	env *environment.Environment,
	docker *docker.Cli,
	containerHelper *ContainerHelper,
	console input.Console,
	alphaFeatureManager *alpha.FeatureManager,
	commandRunner exec.CommandRunner,
) CompositeFrameworkService

NewDockerProject creates a new instance of a Azd project that leverages docker for building

func NewSwaProject

func NewSwaProject(
	env *environment.Environment,
	console input.Console,
	commandRunner exec.CommandRunner,
	swa *swa.Cli,
	framework FrameworkService,
) CompositeFrameworkService

NewSwaProject creates a new instance of a Azd project that leverages swa cli for building

type ContainerAppProps

type ContainerAppProps struct {
	Port int             `yaml:"port,omitempty"`
	Env  []ServiceEnvVar `yaml:"env,omitempty"`
}

type ContainerFile

type ContainerFile struct {
	ServiceConfig *ServiceConfig
	Sources       []string
	Destination   string
}

type ContainerHelper

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

func NewContainerHelper

func NewContainerHelper(
	azdContext *azdcontext.AzdContext,
	envManager environment.Manager,
	clock clock.Clock,
	containerRegistryService azapi.ContainerRegistryService,
	remoteBuildManager *containerregistry.RemoteBuildManager,
	commandRunner exec.CommandRunner,
	docker *docker.Cli,
	dotNetCli *dotnet.Cli,
	console input.Console,
	cloud *cloud.Cloud,
) *ContainerHelper

func (*ContainerHelper) Build

func (ch *ContainerHelper) Build(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	serviceContext *ServiceContext,
	progress *async.Progress[ServiceProgress],
) (*ServiceBuildResult, error)

func (*ContainerHelper) Credentials

func (ch *ContainerHelper) Credentials(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	targetResource *environment.TargetResource,
) (*azapi.DockerCredentials, error)

func (*ContainerHelper) DefaultImageName

func (ch *ContainerHelper) DefaultImageName(ctx context.Context, serviceConfig *ServiceConfig) (string, error)

DefaultImageName returns a default image name generated from the service name and environment name.

func (*ContainerHelper) DefaultImageTag

func (ch *ContainerHelper) DefaultImageTag() string

DefaultImageTag returns a default image tag generated from the current time.

func (*ContainerHelper) DockerfileBuilder

func (ch *ContainerHelper) DockerfileBuilder() *DockerfileBuilder

DockerfileBuilder returns a new DockerfileBuilder instance for building Dockerfiles programmatically.

func (*ContainerHelper) GeneratedImage

func (ch *ContainerHelper) GeneratedImage(
	ctx context.Context,
	serviceConfig *ServiceConfig,
) (*docker.ContainerImage, error)

GeneratedImage returns the configured image from the service configuration or a default image name generated from the service name and environment name.

func (*ContainerHelper) LocalImageTag

func (ch *ContainerHelper) LocalImageTag(
	ctx context.Context,
	serviceConfig *ServiceConfig,
) (string, error)

LocalImageTag returns the local image tag for the service configuration.

func (*ContainerHelper) Login

func (ch *ContainerHelper) Login(
	ctx context.Context,
	serviceConfig *ServiceConfig,
) (string, error)

Login logs into the container registry specified by AZURE_CONTAINER_REGISTRY_ENDPOINT in the environment. On success, it returns the name of the container registry that was logged into.

func (*ContainerHelper) Package

func (ch *ContainerHelper) Package(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	serviceContext *ServiceContext,
	progress *async.Progress[ServiceProgress],
) (*ServicePackageResult, error)

func (*ContainerHelper) Publish

func (ch *ContainerHelper) Publish(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	serviceContext *ServiceContext,
	targetResource *environment.TargetResource,
	progress *async.Progress[ServiceProgress],
	options *PublishOptions,
) (*ServicePublishResult, error)

Publish pushes an image to a remote server and returns the fully qualified remote image name.

func (*ContainerHelper) RegistryName

func (ch *ContainerHelper) RegistryName(ctx context.Context, serviceConfig *ServiceConfig) (string, error)

RegistryName returns the name of the destination container registry to use for the current environment from the following: 1. AZURE_CONTAINER_REGISTRY_ENDPOINT environment variable 2. docker.registry from the service configuration

func (*ContainerHelper) RemoteImageTag

func (ch *ContainerHelper) RemoteImageTag(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	localImageTag string,
	imageOverride *imageOverride,
) (string, error)

RemoteImageTag returns the remote image tag for the service configuration.

func (*ContainerHelper) RemoveLocalImage

func (ch *ContainerHelper) RemoveLocalImage(ctx context.Context, imageName string) error

RemoveLocalImage removes a local Docker image

func (*ContainerHelper) RequiredExternalTools

func (ch *ContainerHelper) RequiredExternalTools(ctx context.Context, serviceConfig *ServiceConfig) []tools.ExternalTool

type CosmosDBContainerProps

type CosmosDBContainerProps struct {
	Name          string   `yaml:"name,omitempty"`
	PartitionKeys []string `yaml:"partitionKeys,omitempty"`
}

type CosmosDBProps

type CosmosDBProps struct {
	Containers []CosmosDBContainerProps `yaml:"containers,omitempty"`
}

type DockerProjectOptions

type DockerProjectOptions struct {
	Path        string                    `yaml:"path,omitempty"        json:"path,omitempty"`
	Context     string                    `yaml:"context,omitempty"     json:"context,omitempty"`
	Platform    string                    `yaml:"platform,omitempty"    json:"platform,omitempty"`
	Target      string                    `yaml:"target,omitempty"      json:"target,omitempty"`
	Registry    osutil.ExpandableString   `yaml:"registry,omitempty"    json:"registry,omitempty"`
	Image       osutil.ExpandableString   `yaml:"image,omitempty"       json:"image,omitempty"`
	Tag         osutil.ExpandableString   `yaml:"tag,omitempty"         json:"tag,omitempty"`
	RemoteBuild bool                      `yaml:"remoteBuild,omitempty" json:"remoteBuild,omitempty"`
	BuildArgs   []osutil.ExpandableString `yaml:"buildArgs,omitempty"   json:"buildArgs,omitempty"`
	// not supported from azure.yaml directly yet. Adding it for Aspire to use it, initially.
	// Aspire would pass the secret keys, which are env vars that azd will set just to run docker build.
	BuildSecrets []string `yaml:"-"                     json:"-"`
	BuildEnv     []string `yaml:"-"                     json:"-"`
	//InMemDockerfile allow projects to specify a dockerfile contents directly instead of a path on disk.
	// This is not supported from azure.yaml.
	// This is used by projects like Aspire that can generate a dockerfile on the fly and don't want to write it to disk.
	// When this is set, whatever value in Path is ignored and the dockerfile contents in this property is used instead.
	InMemDockerfile []byte `yaml:"-"                     json:"-"`
}

type DockerfileBuilder

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

DockerfileBuilder provides a fluent API for building Dockerfiles programmatically.

func NewDockerfileBuilder

func NewDockerfileBuilder() *DockerfileBuilder

NewDockerfileBuilder creates a new DockerfileBuilder instance.

func (*DockerfileBuilder) Arg

func (b *DockerfileBuilder) Arg(name string, defaultValue ...string) *DockerfileBuilder

Arg adds a global ARG statement to define a build-time variable before any stages. Global ARG statements appear before the first FROM statement and can be used to parameterize the base image selection.

func (*DockerfileBuilder) Build

func (b *DockerfileBuilder) Build(w io.Writer) error

Build writes the Dockerfile content to the specified writer.

func (*DockerfileBuilder) From

func (b *DockerfileBuilder) From(image string, stageName ...string) *DockerfileStage

From adds a FROM statement to start a new stage. If stageName is provided, it creates a named stage for multi-stage builds.

type DockerfileStage

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

DockerfileStage represents a stage within a multi-stage Dockerfile.

func (*DockerfileStage) Arg

func (s *DockerfileStage) Arg(name string, defaultValue ...string) *DockerfileStage

Arg adds an ARG statement to the stage to define a build-time variable.

func (*DockerfileStage) Cmd

func (s *DockerfileStage) Cmd(command ...string) *DockerfileStage

Cmd adds a CMD statement to set the default command.

func (*DockerfileStage) Comment

func (s *DockerfileStage) Comment(comment string) *DockerfileStage

Comment adds a comment to the Dockerfile. Multi-line comments are supported.

func (*DockerfileStage) Copy

func (s *DockerfileStage) Copy(source, destination string, chown ...string) *DockerfileStage

Copy adds a COPY statement to copy files from the build context.

func (*DockerfileStage) CopyFrom

func (s *DockerfileStage) CopyFrom(from, source, destination string, chown ...string) *DockerfileStage

CopyFrom adds a COPY statement to copy files from another stage.

func (*DockerfileStage) EmptyLine

func (s *DockerfileStage) EmptyLine() *DockerfileStage

EmptyLine adds an empty line to the Dockerfile for better readability.

func (*DockerfileStage) Entrypoint

func (s *DockerfileStage) Entrypoint(command ...string) *DockerfileStage

Entrypoint adds an ENTRYPOINT statement to set the container entrypoint.

func (*DockerfileStage) Env

func (s *DockerfileStage) Env(name, value string) *DockerfileStage

Env adds an ENV statement to set an environment variable.

func (*DockerfileStage) Expose

func (s *DockerfileStage) Expose(port int) *DockerfileStage

Expose adds an EXPOSE statement to expose a port.

func (*DockerfileStage) Run

func (s *DockerfileStage) Run(command string) *DockerfileStage

Run adds a RUN statement to execute a command.

func (*DockerfileStage) RunWithMounts

func (s *DockerfileStage) RunWithMounts(command string, mounts ...string) *DockerfileStage

RunWithMounts adds a RUN statement with mount options for BuildKit.

func (*DockerfileStage) User

func (s *DockerfileStage) User(user string) *DockerfileStage

User adds a USER statement to set the user for subsequent commands.

func (*DockerfileStage) WorkDir

func (s *DockerfileStage) WorkDir(path string) *DockerfileStage

WorkDir adds a WORKDIR statement to set the working directory.

type DotNetContainerAppOptions

type DotNetContainerAppOptions struct {
	Manifest    *apphost.Manifest
	AppHostPath string
	ProjectName string
	// ContainerImage is non-empty when a prebuilt container image is being used.
	ContainerImage string
	// ContainerFiles is a list of files to include in the container image.
	ContainerFiles map[string]ContainerFile
}

type DotNetImporter

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

DotNetImporter is an importer that is able to import projects and infrastructure from a manifest produced by a .NET App.

func NewDotNetImporter

func NewDotNetImporter(
	dotnetCli *dotnet.Cli,
	console input.Console,
	lazyEnv *lazy.Lazy[*environment.Environment],
	lazyEnvManager *lazy.Lazy[environment.Manager],
	alphaFeatureManager *alpha.FeatureManager,
) *DotNetImporter

func (*DotNetImporter) CanImport

func (ai *DotNetImporter) CanImport(ctx context.Context, projectPath string) (bool, error)

CanImport returns true when the given project can be imported by this importer. Only some .NET Apps are able to produce the manifest that importer expects.

func (*DotNetImporter) GenerateAllInfrastructure

func (ai *DotNetImporter) GenerateAllInfrastructure(ctx context.Context, p *ProjectConfig, svcConfig *ServiceConfig,
) (fs.FS, error)

func (*DotNetImporter) ProjectInfrastructure

func (ai *DotNetImporter) ProjectInfrastructure(ctx context.Context, svcConfig *ServiceConfig) (*Infra, error)

func (*DotNetImporter) ReadManifest

func (ai *DotNetImporter) ReadManifest(ctx context.Context, svcConfig *ServiceConfig) (*apphost.Manifest, error)

ReadManifest reads the manifest for the given app host service, and caches the result.

func (*DotNetImporter) Services

func (ai *DotNetImporter) Services(
	ctx context.Context, p *ProjectConfig, svcConfig *ServiceConfig,
) (map[string]*ServiceConfig, error)

type EmitEnv

type EmitEnv struct {
	// The function map to use for evaluating expressions.
	FuncMap scaffold.FuncMap

	// ResourceVarName is the name of Bicep symbol to assign property expressions.
	ResourceVarName string
}

type EventHubsProps

type EventHubsProps struct {
	Hubs []string `yaml:"hubs,omitempty"`
}

type ExternalFrameworkService

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

func (*ExternalFrameworkService) Build

func (efs *ExternalFrameworkService) Build(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	serviceContext *ServiceContext,
	progress *async.Progress[ServiceProgress],
) (*ServiceBuildResult, error)

Build builds the source for the framework service

func (*ExternalFrameworkService) Initialize

func (efs *ExternalFrameworkService) Initialize(ctx context.Context, serviceConfig *ServiceConfig) error

Initialize initializes the framework service for the specified service configuration

func (*ExternalFrameworkService) Package

func (efs *ExternalFrameworkService) Package(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	serviceContext *ServiceContext,
	progress *async.Progress[ServiceProgress],
) (*ServicePackageResult, error)

Package packages the source suitable for deployment

func (*ExternalFrameworkService) RequiredExternalTools

func (efs *ExternalFrameworkService) RequiredExternalTools(
	ctx context.Context,
	serviceConfig *ServiceConfig,
) []tools.ExternalTool

RequiredExternalTools gets a list of the required external tools for the framework service

func (*ExternalFrameworkService) Requirements

func (efs *ExternalFrameworkService) Requirements() FrameworkRequirements

Requirements gets the requirements for the language or framework service

func (*ExternalFrameworkService) Restore

func (efs *ExternalFrameworkService) Restore(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	serviceContext *ServiceContext,
	progress *async.Progress[ServiceProgress],
) (*ServiceRestoreResult, error)

Restore restores dependencies for the framework service

type ExternalServiceTarget

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

func (*ExternalServiceTarget) Deploy

func (est *ExternalServiceTarget) Deploy(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	serviceContext *ServiceContext,
	targetResource *environment.TargetResource,
	progress *async.Progress[ServiceProgress],
) (*ServiceDeployResult, error)

Deploy deploys the given deployment artifact to the target resource

func (*ExternalServiceTarget) Endpoints

func (est *ExternalServiceTarget) Endpoints(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	targetResource *environment.TargetResource,
) ([]string, error)

Endpoints gets the endpoints a service exposes.

func (*ExternalServiceTarget) Initialize

func (est *ExternalServiceTarget) Initialize(ctx context.Context, serviceConfig *ServiceConfig) error

Initialize initializes the service target for the specified service configuration. This allows service targets to opt-in to service lifecycle events

func (*ExternalServiceTarget) Package

func (est *ExternalServiceTarget) Package(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	serviceContext *ServiceContext,
	progress *async.Progress[ServiceProgress],
) (*ServicePackageResult, error)

Package prepares artifacts for deployment

func (*ExternalServiceTarget) Publish

func (est *ExternalServiceTarget) Publish(
	ctx context.Context,
	serviceConfig *ServiceConfig,
	serviceContext *ServiceContext,
	targetResource *environment.TargetResource,
	progress *async.Progress[ServiceProgress],
	publishOptions *PublishOptions,
) (*ServicePublishResult, error)

Publish implements ServiceTarget.

func (*ExternalServiceTarget) RequiredExternalTools

func (est *ExternalServiceTarget) RequiredExternalTools(
	ctx context.Context,
	serviceConfig *ServiceConfig,
) []tools.ExternalTool

RequiredExternalTools returns the tools needed to run the deploy operation for this target.

func (*ExternalServiceTarget) ResolveTargetResource

func (est *ExternalServiceTarget) ResolveTargetResource(
	ctx context.Context,
	subscriptionId string,
	serviceConfig *ServiceConfig,
	defaultResolver func() (*environment.TargetResource, error),
) (*environment.TargetResource, error)

ResolveTargetResource resolves the Azure target resource for the service configuration via the extension.

type FindOpts

type FindOpts func(*findFilter)

FindOpts represents functional options for filtering artifacts

func WithKind

func WithKind(kind ArtifactKind) FindOpts

WithKind filters artifacts by the specified kind

func WithLocationKind

func WithLocationKind(locationKind LocationKind) FindOpts

WithLocationKind filters artifacts by the specified location kind

func WithTake

func WithTake(length int) FindOpts

type FrameworkPackageRequirements

type FrameworkPackageRequirements struct {
	RequireRestore bool
	RequireBuild   bool
}

type FrameworkRequirements

type FrameworkRequirements struct {
	Package FrameworkPackageRequirements
}

type FrameworkService

type FrameworkService interface {
	// Gets a list of the required external tools for the framework service
	RequiredExternalTools(ctx context.Context, serviceConfig *ServiceConfig) []tools.ExternalTool

	// Initializes the framework service for the specified service configuration
	// This is useful if the framework needs to subscribe to any service events
	Initialize(ctx context.Context, serviceConfig *ServiceConfig) error

	// Gets the requirements for the language or framework service.
	// This enables more fine grain control on whether the language / framework
	// supports or requires lifecycle commands such as restore, build, and package
	Requirements() FrameworkRequirements

	// Restores dependencies for the framework service
	Restore(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		progress *async.Progress[ServiceProgress],
	) (*ServiceRestoreResult, error)

	// Builds the source for the framework service
	Build(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		progress *async.Progress[ServiceProgress],
	) (*ServiceBuildResult, error)

	// Packages the source suitable for deployment
	// This may optionally perform a rebuild internally depending on the language/framework requirements
	Package(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		progress *async.Progress[ServiceProgress],
	) (*ServicePackageResult, error)
}

FrameworkService is an abstraction for a programming language or framework that describe the required tools as well as implementations for restore and build commands

func NewCustomProject

func NewCustomProject(env *environment.Environment) FrameworkService

NewCustomProject creates a new instance of the custom language project

func NewDockerProjectAsFrameworkService

func NewDockerProjectAsFrameworkService(
	env *environment.Environment,
	docker *docker.Cli,
	containerHelper *ContainerHelper,
	console input.Console,
	alphaFeatureManager *alpha.FeatureManager,
	commandRunner exec.CommandRunner,
) FrameworkService

NewDockerProjectAsFrameworkService is the same as NewDockerProject().(FrameworkService) and exists to support our use of DI and ServiceLocators, where we sometimes need to resolve this type as a FrameworkService instance instead of a CompositeFrameworkService as NewDockerProject does.

func NewDotNetProject

func NewDotNetProject(
	dotNetCli *dotnet.Cli,
	env *environment.Environment,
) FrameworkService

NewDotNetProject creates a new instance of a dotnet project

func NewExternalFrameworkService

func NewExternalFrameworkService(
	name string,
	kind ServiceLanguageKind,
	extension *extensions.Extension,
	broker *grpcbroker.MessageBroker[azdext.FrameworkServiceMessage],
	console input.Console,
) FrameworkService

NewExternalFrameworkService creates a new external framework service

func NewMavenProject

func NewMavenProject(env *environment.Environment, mavenCli *maven.Cli, javaCli *javac.Cli) FrameworkService

NewMavenProject creates a new instance of a maven project

func NewNoOpProject

func NewNoOpProject(env *environment.Environment) FrameworkService

NewNoOpProject creates a new instance of a no-op project, which implements the FrameworkService interface but does not perform any actions.

func NewNpmProject

func NewNpmProject(cli *npm.Cli, env *environment.Environment) FrameworkService

NewNpmProject creates a new instance of a NPM project

func NewPythonProject

func NewPythonProject(cli *python.Cli, env *environment.Environment) FrameworkService

NewPythonProject creates a new instance of the Python project

func NewSwaProjectAsFrameworkService

func NewSwaProjectAsFrameworkService(
	env *environment.Environment,
	console input.Console,
	commandRunner exec.CommandRunner,
	swa *swa.Cli,
	framework FrameworkService,
) FrameworkService

NewSwaProjectAsFrameworkService is the same as NewSwaProject().(FrameworkService) and exists to support our use of DI and ServiceLocators, where we sometimes need to resolve this type as a FrameworkService instance instead of a CompositeFrameworkService as NewSwaProject does.

type HooksConfig

type HooksConfig map[string][]*ext.HookConfig

HooksConfig is an alias for map of hook names to slice of hook configurations This custom alias type is used to help support YAML unmarshalling of legacy single hook configurations and new multiple hook configurations

func (HooksConfig) MarshalYAML

func (ch HooksConfig) MarshalYAML() (interface{}, error)

MarshalYAML marshals the hooks configuration to YAML supporting both legacy single hook configurations

func (*HooksConfig) UnmarshalYAML

func (ch *HooksConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML converts the hooks configuration from YAML supporting both legacy single hook configurations and new multiple hook configurations

type ImportManager

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

func NewImportManager

func NewImportManager(dotNetImporter *DotNetImporter) *ImportManager

func (*ImportManager) GenerateAllInfrastructure

func (im *ImportManager) GenerateAllInfrastructure(ctx context.Context, projectConfig *ProjectConfig) (fs.FS, error)

GenerateAllInfrastructure returns a file system containing all infrastructure for the project, rooted at the project directory.

func (*ImportManager) HasAppHost

func (im *ImportManager) HasAppHost(ctx context.Context, projectConfig *ProjectConfig) bool

HasAppHost returns true when there is one AppHost (Aspire) in the project.

func (*ImportManager) HasService

func (im *ImportManager) HasService(ctx context.Context, projectConfig *ProjectConfig, name string) (bool, error)

func (*ImportManager) ProjectInfrastructure

func (im *ImportManager) ProjectInfrastructure(ctx context.Context, projectConfig *ProjectConfig) (*Infra, error)

ProjectInfrastructure parses the project configuration and returns the infrastructure configuration.

The configuration can be explicitly defined on azure.yaml using path and module, or in case these values are not explicitly defined, the project importer uses default values to find the infrastructure.

func (*ImportManager) ServiceStable

func (im *ImportManager) ServiceStable(ctx context.Context, projectConfig *ProjectConfig) ([]*ServiceConfig, error)

Retrieves the list of services in the project, in a stable ordering that is deterministic.

type Infra

type Infra struct {
	Options provisioning.Options

	IsCompose bool
	// contains filtered or unexported fields
}

Infra represents the (possibly temporarily generated) infrastructure. Call [Cleanup] when done with infrastructure, which will cause any temporarily generated files to be removed.

func (*Infra) Cleanup

func (i *Infra) Cleanup() error

type LocationKind

type LocationKind string

LocationKind represents the type of location for an artifact

const (
	LocationKindLocal  LocationKind = "local"  // Local file system path
	LocationKindRemote LocationKind = "remote" // Remote reference (URL, registry, etc.)
)

type PackageOptions

type PackageOptions struct {
	OutputPath string
}

type PipelineOptions

type PipelineOptions struct {
	Provider  string   `yaml:"provider"`
	Variables []string `yaml:"variables"`
	Secrets   []string `yaml:"secrets"`
}

options supported in azure.yaml

type ProjectConfig

type ProjectConfig struct {
	// Metadata that specifies the schema version.
	//
	// This is currently only used during [Save] to write the file schema annotation for intellisense.
	// This should include the "v" prefix used in official version numbers.
	MetaSchemaVersion string `yaml:"-"`

	RequiredVersions  *RequiredVersions          `yaml:"requiredVersions,omitempty"`
	Name              string                     `yaml:"name"`
	ResourceGroupName osutil.ExpandableString    `yaml:"resourceGroup,omitempty"`
	Path              string                     `yaml:"-"`
	Metadata          *ProjectMetadata           `yaml:"metadata,omitempty"`
	Services          map[string]*ServiceConfig  `yaml:"services,omitempty"`
	Infra             provisioning.Options       `yaml:"infra,omitempty"`
	Pipeline          PipelineOptions            `yaml:"pipeline,omitempty"`
	Hooks             HooksConfig                `yaml:"hooks,omitempty"`
	State             *state.Config              `yaml:"state,omitempty"`
	Platform          *platform.Config           `yaml:"platform,omitempty"`
	Workflows         workflow.WorkflowMap       `yaml:"workflows,omitempty"`
	Cloud             *cloud.Config              `yaml:"cloud,omitempty"`
	Resources         map[string]*ResourceConfig `yaml:"resources,omitempty"`

	// AdditionalProperties captures any unknown YAML fields for extension support
	AdditionalProperties map[string]interface{} `yaml:",inline"`

	*ext.EventDispatcher[ProjectLifecycleEventArgs] `yaml:"-"`
}

ProjectConfig is the top level object serialized into an azure.yaml file. When changing project structure, make sure to update the JSON schema file for azure.yaml (<workspace root>/schemas/vN.M/azure.yaml.json).

func Load

func Load(ctx context.Context, projectFilePath string) (*ProjectConfig, error)

Load hydrates the azure.yaml configuring into an viewable structure This does not evaluate any tooling

func New

func New(ctx context.Context, projectFilePath string, projectName string) (*ProjectConfig, error)

func Parse

func Parse(ctx context.Context, yamlContent string) (*ProjectConfig, error)

Parse will parse a project from a yaml string and return the project configuration

type ProjectLifecycleEventArgs

type ProjectLifecycleEventArgs struct {
	Project *ProjectConfig
	Args    map[string]any
}

Project lifecycle event arguments

type ProjectLifecycleEventHandlerFn

type ProjectLifecycleEventHandlerFn func(ctx context.Context, args ProjectLifecycleEventArgs) error

Function definition for project events

type ProjectManager

type ProjectManager interface {
	// Initializes the project and all child services defined within the project configuration
	//
	// The initialization process will instantiate the framework & service target associated
	// with the service config that enables the scenario for these components to add event
	// handlers to participate in the lifecycle of an azd project
	Initialize(ctx context.Context, projectConfig *ProjectConfig) error

	// Returns the default service name to target based on the current working directory.
	//
	//   - If the working directory is the project directory, then an empty string is returned to indicate all services.
	//   - If the working directory is a service directory, then the name of the service is returned.
	//   - If the working directory is neither the project directory nor a service directory, then
	//     ErrNoDefaultService is returned.
	DefaultServiceFromWd(ctx context.Context, projectConfig *ProjectConfig) (serviceConfig *ServiceConfig, err error)

	// Ensures that all required tools are installed for the project and all child services
	// This includes tools required by the framework and tools required by the service target
	EnsureAllTools(ctx context.Context, projectConfig *ProjectConfig, serviceFilterFn ServiceFilterPredicate) error

	// Ensures that all required framework tools are installed for the project and all child services
	EnsureFrameworkTools(ctx context.Context, projectConfig *ProjectConfig, serviceFilterFn ServiceFilterPredicate) error

	// Ensures that all required service target tools are installed for the project and all child services
	EnsureServiceTargetTools(ctx context.Context, projectConfig *ProjectConfig, serviceFilterFn ServiceFilterPredicate) error

	// Ensures that all required tools for restore are installed for the project and all child services. This is like
	// EnsureFrameworkTools but treats docker projects differently - it requires the tools for the inner project (i.e. npm)
	// instead of needing docker tools themselves, since when doing a project restore, docker is not invoked.
	EnsureRestoreTools(ctx context.Context, projectConfig *ProjectConfig, serviceFilterFn ServiceFilterPredicate) error
}

ProjectManager provides a layer for working with root level azd projects and invoking project specific commands

func NewProjectManager

func NewProjectManager(
	azdContext *azdcontext.AzdContext,
	serviceManager ServiceManager,
	importManager *ImportManager,
) ProjectManager

NewProjectManager creates a new instance of the ProjectManager

type ProjectMetadata

type ProjectMetadata struct {
	// Template is a slug that identifies the template and a version. This attribute should be
	// in every template that we ship.
	// ex: todo-python-mongo@version
	Template string
}

type PublishOptions

type PublishOptions struct {
	// Image specifies the target image in the form '[registry/]repository[:tag]'
	Image string
}

PublishOptions holds options for container operations such as publish and deploy.

type RequiredVersions

type RequiredVersions struct {
	// When non nil, a semver range (in the format expected by semver.ParseRange).
	Azd        *string            `yaml:"azd,omitempty"`
	Extensions map[string]*string `yaml:"extensions,omitempty"`
}

RequiredVersions contains information about what versions of tools this project requires. If a value is nil, it is treated as if there is no constraint.

type ResourceConfig

type ResourceConfig struct {
	// Reference to the parent project configuration
	Project *ProjectConfig `yaml:"-"`
	// Type of resource
	Type ResourceType `yaml:"type"`
	// The name of the resource
	Name string `yaml:"name,omitempty"`
	// The properties for the resource
	RawProps map[string]yaml.Node `yaml:",inline"`
	Props    interface{}          `yaml:"-"`
	// Relationships to other resources
	Uses []string `yaml:"uses,omitempty"`
	// Existing indicates whether the resource is an existing resource.
	Existing bool `yaml:"existing,omitempty"`
	// Resource ID in the project.
	// This is a virtual field. It is stored as environment state.
	ResourceId string `yaml:"-"`

	// IncludeName indicates whether the `name` field should be included upon serialization.
	IncludeName bool `yaml:"-"`
}

func DependentResourcesOf

func DependentResourcesOf(resource *ResourceConfig) []*ResourceConfig

DependentResourcesOf returns implicit resource dependencies for a given resource type. These dependencies (like Key Vault to store connection strings, passwords for databases) are automatically added to the project configuration. Returns an empty slice if none exist.

func (*ResourceConfig) MarshalYAML

func (r *ResourceConfig) MarshalYAML() (interface{}, error)

func (*ResourceConfig) UnmarshalYAML

func (r *ResourceConfig) UnmarshalYAML(value *yaml.Node) error

type ResourceManager

type ResourceManager interface {
	GetResourceGroupName(
		ctx context.Context,
		subscriptionId string,
		resourceGroupTemplate osutil.ExpandableString,
	) (string, error)
	GetServiceResources(
		ctx context.Context,
		subscriptionId string,
		resourceGroupName string,
		serviceConfig *ServiceConfig,
	) ([]*azapi.ResourceExtended, error)
	GetServiceResource(
		ctx context.Context,
		subscriptionId string,
		resourceGroupName string,
		serviceConfig *ServiceConfig,
		rerunCommand string,
	) (*azapi.ResourceExtended, error)
	GetTargetResource(
		ctx context.Context,
		subscriptionId string,
		serviceConfig *ServiceConfig,
	) (*environment.TargetResource, error)
}

ResourceManager provides a layer to query for Azure resource for azd project and services This would typically be used during deployment when azd need to deploy applications to the Azure resource hosting the application

func NewResourceManager

func NewResourceManager(
	env *environment.Environment,
	deploymentService *azapi.StandardDeployments,
	resourceService *azapi.ResourceService,
	azureResourceManager infra.ResourceManager,
) ResourceManager

NewResourceManager creates a new instance of the project resource manager

type ResourceType

type ResourceType string
const (
	ResourceTypeDbRedis             ResourceType = "db.redis"
	ResourceTypeDbPostgres          ResourceType = "db.postgres"
	ResourceTypeDbMySql             ResourceType = "db.mysql"
	ResourceTypeDbMongo             ResourceType = "db.mongo"
	ResourceTypeDbCosmos            ResourceType = "db.cosmos"
	ResourceTypeHostContainerApp    ResourceType = "host.containerapp"
	ResourceTypeHostAppService      ResourceType = "host.appservice"
	ResourceTypeOpenAiModel         ResourceType = "ai.openai.model"
	ResourceTypeMessagingEventHubs  ResourceType = "messaging.eventhubs"
	ResourceTypeMessagingServiceBus ResourceType = "messaging.servicebus"
	ResourceTypeStorage             ResourceType = "storage"
	ResourceTypeAiProject           ResourceType = "ai.project"
	ResourceTypeAiSearch            ResourceType = "ai.search"
	ResourceTypeKeyVault            ResourceType = "keyvault"
)

func AllResourceTypes

func AllResourceTypes() []ResourceType

func (ResourceType) AzureResourceType

func (r ResourceType) AzureResourceType() string

func (ResourceType) String

func (r ResourceType) String() string

type ServiceBuildResult

type ServiceBuildResult struct {
	Artifacts ArtifactCollection `json:"artifacts"`
}

ServiceBuildResult is the result of a successful Build operation

type ServiceBusProps

type ServiceBusProps struct {
	Queues []string `yaml:"queues,omitempty"`
	Topics []string `yaml:"topics,omitempty"`
}

type ServiceConfig

type ServiceConfig struct {
	// Reference to the parent project configuration
	Project *ProjectConfig `yaml:"-"`
	// The friendly name/key of the project from the azure.yaml file
	Name string `yaml:"-"`
	// The azure resource group to deploy the service to
	ResourceGroupName osutil.ExpandableString `yaml:"resourceGroup,omitempty"`
	// The name used to override the default azure resource name
	ResourceName osutil.ExpandableString `yaml:"resourceName,omitempty"`
	// The ARM api version to use for the service. If not specified, the latest version is used.
	ApiVersion string `yaml:"apiVersion,omitempty"`
	// The relative path to the project folder from the project root
	RelativePath string `yaml:"project"`
	// The azure hosting model to use, ex) appservice, function, containerapp
	Host ServiceTargetKind `yaml:"host"`
	// The programming language of the project
	Language ServiceLanguageKind `yaml:"language"`
	// The output path for build artifacts
	OutputPath string `yaml:"dist,omitempty"`
	// The source image to use for container based applications
	Image osutil.ExpandableString `yaml:"image,omitempty"`
	// The optional docker options for configuring the output image
	Docker DockerProjectOptions `yaml:"docker,omitempty"`
	// The optional K8S / AKS options
	K8s AksOptions `yaml:"k8s,omitempty"`
	// Infrastructure module path relative to the root infra folder
	Module string `yaml:"module,omitempty"`
	// The infrastructure provisioning configuration
	Infra provisioning.Options `yaml:"infra,omitempty"`
	// Hook configuration for service
	Hooks HooksConfig `yaml:"hooks,omitempty"`
	// Dependencies on other services and resources
	Uses []string `yaml:"uses,omitempty"`
	// Options specific to the DotNetContainerApp target. These are set by the importer and
	// can not be controlled via the project file today.
	DotNetContainerApp *DotNetContainerAppOptions `yaml:"-,omitempty"`
	// Custom configuration for the service target
	Config map[string]any `yaml:"config,omitempty"`

	// Environment variables to set for the service
	Environment osutil.ExpandableMap `yaml:"env,omitempty"`

	// AdditionalProperties captures any unknown YAML fields for extension support
	AdditionalProperties map[string]interface{} `yaml:",inline"`

	*ext.EventDispatcher[ServiceLifecycleEventArgs] `yaml:"-"`

	// Turns service into a service that is only to be built but not deployed.
	// This is currently used by Aspire.
	BuildOnly bool `yaml:"-"`
	// contains filtered or unexported fields
}

func (*ServiceConfig) Path

func (sc *ServiceConfig) Path() string

Path returns the fully qualified path to the project

type ServiceContext

type ServiceContext struct {
	Restore ArtifactCollection `json:"restore"`
	Build   ArtifactCollection `json:"build"`
	Package ArtifactCollection `json:"package"`
	Publish ArtifactCollection `json:"publish"`
	Deploy  ArtifactCollection `json:"deploy"`
}

ServiceContext defines the shared pipeline state across all phases of the Azure Developer CLI (azd) service lifecycle. It captures the results of each phase (Restore, Build, Package, Publish, Deploy) in a consistent, extensible format that is accessible to both core and external extension providers.

func NewServiceContext

func NewServiceContext() *ServiceContext

NewServiceContext creates a new ServiceContext with initialized maps and slices

type ServiceDeployResult

type ServiceDeployResult struct {
	Artifacts ArtifactCollection `json:"artifacts"`
}

ServiceDeployResult is the result of a successful Deploy operation

type ServiceEnvVar

type ServiceEnvVar struct {
	Name string `yaml:"name,omitempty"`

	// either Value or Secret can be set, but not both
	Value  string `yaml:"value,omitempty"`
	Secret string `yaml:"secret,omitempty"`
}

type ServiceFilterPredicate

type ServiceFilterPredicate func(svc *ServiceConfig) bool

ServiceFilterPredicate is a function that can be used to filter services that match a given criteria

type ServiceLanguageKind

type ServiceLanguageKind string
const (
	ServiceLanguageNone       ServiceLanguageKind = ""
	ServiceLanguageDotNet     ServiceLanguageKind = "dotnet"
	ServiceLanguageCsharp     ServiceLanguageKind = "csharp"
	ServiceLanguageFsharp     ServiceLanguageKind = "fsharp"
	ServiceLanguageJavaScript ServiceLanguageKind = "js"
	ServiceLanguageTypeScript ServiceLanguageKind = "ts"
	ServiceLanguagePython     ServiceLanguageKind = "python"
	ServiceLanguageJava       ServiceLanguageKind = "java"
	ServiceLanguageDocker     ServiceLanguageKind = "docker"
	ServiceLanguageSwa        ServiceLanguageKind = "swa"
	ServiceLanguageCustom     ServiceLanguageKind = "custom"
)

func (ServiceLanguageKind) IsDotNet

func (slk ServiceLanguageKind) IsDotNet() bool

type ServiceLifecycleEventArgs

type ServiceLifecycleEventArgs struct {
	Project        *ProjectConfig
	Service        *ServiceConfig
	ServiceContext *ServiceContext
	Args           map[string]any
}

ServiceLifecycleEventArgs are the event arguments available when any service lifecycle event has been triggered

type ServiceManager

type ServiceManager interface {
	// Gets all of the required framework/service target tools for the specified service config
	GetRequiredTools(ctx context.Context, serviceConfig *ServiceConfig) ([]tools.ExternalTool, error)

	// Initializes the service configuration and dependent framework & service target
	// This allows frameworks & service targets to hook into a services lifecycle events
	Initialize(ctx context.Context, serviceConfig *ServiceConfig) error

	// Restores the code dependencies for the specified service config
	Restore(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		progress *async.Progress[ServiceProgress],
	) (*ServiceRestoreResult, error)

	// Builds the code for the specified service config
	// Will call the language compile for compiled languages or
	// may copy build artifacts to a configured output folder
	Build(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		progress *async.Progress[ServiceProgress],
	) (*ServiceBuildResult, error)

	// Packages the code for the specified service config
	// Depending on the service configuration this will generate an artifact
	// that can be consumed by the hosting Azure service.
	// Common examples could be a zip archive for app service or
	// Docker images for container apps and AKS
	Package(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		progress *async.Progress[ServiceProgress],
		options *PackageOptions,
	) (*ServicePackageResult, error)

	// Publishes the service to make it available to other services
	// A common example would be pushing container images to a container registry.
	Publish(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		progress *async.Progress[ServiceProgress],
		publishOptions *PublishOptions,
	) (*ServicePublishResult, error)

	// Deploys the generated artifacts to the Azure resource that will
	// host the service application
	// Common examples would be uploading zip archive using ZipDeploy deployment or
	// pushing container images to a container registry and creating a revision.
	Deploy(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		progress *async.Progress[ServiceProgress],
	) (*ServiceDeployResult, error)

	/// GetTargetResource finds and resolves the target Azure resource for the specified service configuration and host
	GetTargetResource(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceTarget ServiceTarget,
	) (*environment.TargetResource, error)

	// Gets the framework service for the specified service config
	// The framework service performs the restoration and building of the service app code
	GetFrameworkService(ctx context.Context, serviceConfig *ServiceConfig) (FrameworkService, error)

	// Gets the service target service for the specified service config
	// The service target is responsible for packaging & deploying the service app code
	// to the destination Azure resource
	GetServiceTarget(ctx context.Context, serviceConfig *ServiceConfig) (ServiceTarget, error)
}

ServiceManager provides a management layer for performing operations against an azd service within a project The component performs all of the heavy lifting for executing all lifecycle operations for a service.

All service lifecycle command leverage our async Task library to expose a common interface for handling long running operations including how we handle incremental progress updates and error handling.

func NewServiceManager

func NewServiceManager(
	env *environment.Environment,
	resourceManager ResourceManager,
	serviceLocator ioc.ServiceLocator,
	operationCache ServiceOperationCache,
	alphaFeatureManager *alpha.FeatureManager,
) ServiceManager

NewServiceManager creates a new instance of the ServiceManager component

type ServiceOperationCache

type ServiceOperationCache map[string]any

ServiceOperationCache is an alias to map used for internal caching of service operation results The ServiceManager is a scoped component since it depends on the current environment The ServiceOperationCache is used as a singleton cache for all service manager instances

type ServicePackageResult

type ServicePackageResult struct {
	Artifacts ArtifactCollection `json:"artifacts"`
}

ServicePackageResult is the result of a successful Package operation

type ServiceProgress

type ServiceProgress struct {
	Message   string
	Timestamp time.Time
}

ServiceProgress represents an incremental progress message during a service operation such as restore, build, package & deploy

func NewServiceProgress

func NewServiceProgress(message string) ServiceProgress

NewServiceProgress is a helper method to create a new progress message with a current timestamp

type ServicePublishResult

type ServicePublishResult struct {
	Artifacts ArtifactCollection `json:"artifacts"`
}

ServicePublishResult is the result of a successful Publish operation for services.

type ServiceRestoreResult

type ServiceRestoreResult struct {
	Artifacts ArtifactCollection `json:"artifacts"`
}

ServiceRestoreResult is the result of a successful Restore operation

type ServiceTarget

type ServiceTarget interface {
	// Initializes the service target for the specified service configuration.
	// This allows service targets to opt-in to service lifecycle events
	Initialize(ctx context.Context, serviceConfig *ServiceConfig) error

	// RequiredExternalTools are the tools needed to run the deploy operation for this
	// target.
	RequiredExternalTools(ctx context.Context, serviceConfig *ServiceConfig) []tools.ExternalTool

	// Package prepares artifacts for deployment
	Package(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		progress *async.Progress[ServiceProgress],
	) (*ServicePackageResult, error)

	// Publish pushes the prepared artifacts without performing deployment.
	Publish(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		targetResource *environment.TargetResource,
		progress *async.Progress[ServiceProgress],
		publishOptions *PublishOptions,
	) (*ServicePublishResult, error)

	// Deploys the given deployment artifact to the target resource
	Deploy(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		serviceContext *ServiceContext,
		targetResource *environment.TargetResource,
		progress *async.Progress[ServiceProgress],
	) (*ServiceDeployResult, error)

	// Endpoints gets the endpoints a service exposes.
	Endpoints(
		ctx context.Context,
		serviceConfig *ServiceConfig,
		targetResource *environment.TargetResource,
	) ([]string, error)
}

func NewAiEndpointTarget

func NewAiEndpointTarget(
	env *environment.Environment,
	envManager environment.Manager,
	aiHelper AiHelper,
) ServiceTarget

NewAiEndpointTarget creates a new aiEndpointTarget instance

func NewAksTarget

func NewAksTarget(
	env *environment.Environment,
	envManager environment.Manager,
	console input.Console,
	managedClustersService azapi.ManagedClustersService,
	resourceManager ResourceManager,
	kubectlCli *kubectl.Cli,
	kubeLoginCli *kubelogin.Cli,
	helmCli *helm.Cli,
	kustomizeCli *kustomize.Cli,
	containerHelper *ContainerHelper,
	featureManager *alpha.FeatureManager,
) ServiceTarget

Creates a new instance of the AKS service target

func NewAppServiceTarget

func NewAppServiceTarget(
	env *environment.Environment,
	azCli *azapi.AzureClient,
	console input.Console,
) ServiceTarget

NewAppServiceTarget creates a new instance of the AppServiceTarget

func NewContainerAppTarget

func NewContainerAppTarget(
	env *environment.Environment,
	envManager environment.Manager,
	containerHelper *ContainerHelper,
	containerAppService containerapps.ContainerAppService,
	resourceManager ResourceManager,
	deploymentService *azapi.StandardDeployments,
	console input.Console,
	commandRunner exec.CommandRunner,
) ServiceTarget

NewContainerAppTarget creates the container app service target.

The target resource can be partially filled with only ResourceGroupName, since container apps can be provisioned during deployment.

func NewDotNetContainerAppTarget

func NewDotNetContainerAppTarget(
	env *environment.Environment,
	containerHelper *ContainerHelper,
	containerAppService containerapps.ContainerAppService,
	resourceManager ResourceManager,
	dotNetCli *dotnet.Cli,
	bicepCli *bicep.Cli,
	cosmosDbService cosmosdb.CosmosDbService,
	sqlDbService sqldb.SqlDbService,
	keyvaultService keyvault.KeyVaultService,
	alphaFeatureManager *alpha.FeatureManager,
	deploymentService azapi.DeploymentService,
	azureClient *azapi.AzureClient,
) ServiceTarget

NewDotNetContainerAppTarget creates the Service Target for a Container App that is written in .NET. Unlike ContainerAppTarget, this target does not require a Dockerfile to be present in the project. Instead, it uses the built in support in .NET 8 for publishing containers using `dotnet publish`. In addition, it uses a different deployment strategy built on a yaml manifest file, using the same format `az containerapp create --yaml`, with additional support for using text/template to do replacements, similar to tools like Helm.

Note that unlike ContainerAppTarget this target does not add SERVICE_<XYZ>_IMAGE_NAME values to the environment, instead, the image name is present on the context object used when rendering the template.

func NewExternalServiceTarget

func NewExternalServiceTarget(
	name string,
	kind ServiceTargetKind,
	extension *extensions.Extension,
	broker *grpcbroker.MessageBroker[azdext.ServiceTargetMessage],
	console input.Console,
	prompters prompt.Prompter,
	env *environment.Environment,
) ServiceTarget

NewExternalServiceTarget creates a new external service target

func NewFunctionAppTarget

func NewFunctionAppTarget(
	env *environment.Environment,
	azCli *azapi.AzureClient,
) ServiceTarget

NewFunctionAppTarget creates a new instance of the Function App target

func NewSpringAppTarget

func NewSpringAppTarget(
	env *environment.Environment,
	envManager environment.Manager,
) ServiceTarget

NewSpringAppTarget creates the spring app service target.

func NewStaticWebAppTarget

func NewStaticWebAppTarget(
	env *environment.Environment,
	azCli *azapi.AzureClient,
	swaCli *swa.Cli,
) ServiceTarget

NewStaticWebAppTarget creates a new instance of the Static Web App target

type ServiceTargetKind

type ServiceTargetKind string
const (
	NonSpecifiedTarget       ServiceTargetKind = ""
	AppServiceTarget         ServiceTargetKind = "appservice"
	ContainerAppTarget       ServiceTargetKind = "containerapp"
	AzureFunctionTarget      ServiceTargetKind = "function"
	StaticWebAppTarget       ServiceTargetKind = "staticwebapp"
	SpringAppTarget          ServiceTargetKind = "springapp"
	AksTarget                ServiceTargetKind = "aks"
	DotNetContainerAppTarget ServiceTargetKind = "containerapp-dotnet"
	AiEndpointTarget         ServiceTargetKind = "ai.endpoint"
)

func BuiltInServiceTargetKinds

func BuiltInServiceTargetKinds() []ServiceTargetKind

BuiltInServiceTargetKinds returns the slice of built-in service target kinds

func (ServiceTargetKind) IgnoreFile

func (st ServiceTargetKind) IgnoreFile() string

IgnoreFile returns the ignore file associated with the service target. Returns an empty string if no ignore file is used.

func (ServiceTargetKind) RequiresContainer

func (stk ServiceTargetKind) RequiresContainer() bool

RequiresContainer returns true if the service target runs a container image.

func (ServiceTargetKind) SupportsDelayedProvisioning deprecated

func (st ServiceTargetKind) SupportsDelayedProvisioning() bool

SupportsDelayedProvisioning returns true if the service target supports provisioning resources during deployment when they don't exist yet.

Deprecated: Use TargetResourceResolver interface for custom resource resolution instead. Container Apps supports delayed provisioning but implements TargetResourceResolver to provide better error messages when resources are missing in non-bicep deployment scenarios. Retained only for AKS backward compatibility.

type StorageProps

type StorageProps struct {
	Containers []string `yaml:"containers,omitempty"`
}

type TargetResourceResolver

type TargetResourceResolver interface {
	ResolveTargetResource(
		ctx context.Context,
		subscriptionId string,
		serviceConfig *ServiceConfig,
		defaultResolver func() (*environment.TargetResource, error),
	) (*environment.TargetResource, error)
}

type UnsupportedServiceHostError

type UnsupportedServiceHostError struct {
	Host         string
	ServiceName  string
	ErrorMessage string
}

UnsupportedServiceHostError represents an error when a service host is not supported, including the specific host name and service name for context

func (*UnsupportedServiceHostError) Error

Error implements the error interface

Jump to

Keyboard shortcuts

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