Documentation ¶
Index ¶
- Constants
- Variables
- func LoadConfig(ctx context.Context, projectFilePath string) (config.Config, error)
- func OverriddenEndpoints(ctx context.Context, serviceConfig *ServiceConfig, ...) []string
- func Save(ctx context.Context, projectConfig *ProjectConfig, projectFilePath string) error
- func SaveConfig(ctx context.Context, config config.Config, projectFilePath string) error
- type AIModelProps
- type AIModelPropsModel
- type AiEndpointDeploymentResult
- type AiHelper
- type AksDeploymentOptions
- type AksIngressOptions
- type AksOptions
- type AksServiceOptions
- type CompositeFrameworkService
- type ContainerAppProps
- type ContainerHelper
- func (ch *ContainerHelper) Credentials(ctx context.Context, serviceConfig *ServiceConfig, ...) (*azapi.DockerCredentials, error)
- func (ch *ContainerHelper) DefaultImageName(serviceConfig *ServiceConfig) string
- func (ch *ContainerHelper) DefaultImageTag() string
- func (ch *ContainerHelper) Deploy(ctx context.Context, serviceConfig *ServiceConfig, ...) (*ServiceDeployResult, error)
- func (ch *ContainerHelper) GeneratedImage(ctx context.Context, serviceConfig *ServiceConfig) (*docker.ContainerImage, error)
- func (ch *ContainerHelper) LocalImageTag(ctx context.Context, serviceConfig *ServiceConfig) (string, error)
- func (ch *ContainerHelper) Login(ctx context.Context, serviceConfig *ServiceConfig) (string, error)
- func (ch *ContainerHelper) RegistryName(ctx context.Context, serviceConfig *ServiceConfig) (string, error)
- func (ch *ContainerHelper) RemoteImageTag(ctx context.Context, serviceConfig *ServiceConfig, localImageTag string) (string, error)
- func (ch *ContainerHelper) RequiredExternalTools(ctx context.Context, serviceConfig *ServiceConfig) []tools.ExternalTool
- type DockerProjectOptions
- type DotNetContainerAppOptions
- type DotNetImporter
- func (ai *DotNetImporter) CanImport(ctx context.Context, projectPath string) (bool, error)
- func (ai *DotNetImporter) ProjectInfrastructure(ctx context.Context, svcConfig *ServiceConfig) (*Infra, error)
- func (ai *DotNetImporter) ReadManifest(ctx context.Context, svcConfig *ServiceConfig) (*apphost.Manifest, error)
- func (ai *DotNetImporter) Services(ctx context.Context, p *ProjectConfig, svcConfig *ServiceConfig) (map[string]*ServiceConfig, error)
- func (ai *DotNetImporter) SynthAllInfrastructure(ctx context.Context, p *ProjectConfig, svcConfig *ServiceConfig) (fs.FS, error)
- type FrameworkPackageRequirements
- type FrameworkRequirements
- type FrameworkService
- func NewDockerProjectAsFrameworkService(env *environment.Environment, docker *docker.Cli, ...) FrameworkService
- func NewDotNetProject(dotNetCli *dotnet.Cli, env *environment.Environment) FrameworkService
- func NewMavenProject(env *environment.Environment, mavenCli *maven.Cli, javaCli *javac.Cli) FrameworkService
- func NewNoOpProject(env *environment.Environment) FrameworkService
- func NewNpmProject(cli *npm.Cli, env *environment.Environment) FrameworkService
- func NewPythonProject(cli *python.Cli, env *environment.Environment) FrameworkService
- func NewSwaProjectAsFrameworkService(env *environment.Environment, console input.Console, ...) FrameworkService
- type HooksConfig
- type ImportManager
- func (im *ImportManager) HasAppHost(ctx context.Context, projectConfig *ProjectConfig) bool
- func (im *ImportManager) HasService(ctx context.Context, projectConfig *ProjectConfig, name string) (bool, error)
- func (im *ImportManager) ProjectInfrastructure(ctx context.Context, projectConfig *ProjectConfig) (*Infra, error)
- func (im *ImportManager) ServiceStable(ctx context.Context, projectConfig *ProjectConfig) ([]*ServiceConfig, error)
- func (im *ImportManager) SynthAllInfrastructure(ctx context.Context, projectConfig *ProjectConfig) (fs.FS, error)
- type Infra
- type PackageOptions
- type PipelineOptions
- type ProjectConfig
- type ProjectLifecycleEventArgs
- type ProjectLifecycleEventHandlerFn
- type ProjectManager
- type ProjectMetadata
- type RequiredVersions
- type ResourceConfig
- type ResourceManager
- type ResourceType
- type ServiceBuildResult
- type ServiceConfig
- type ServiceDeployResult
- type ServiceEnvVar
- type ServiceFilterPredicate
- type ServiceLanguageKind
- type ServiceLifecycleEventArgs
- type ServiceManager
- type ServiceOperationCache
- type ServicePackageResult
- type ServiceProgress
- type ServiceRestoreResult
- type ServiceTarget
- func NewAiEndpointTarget(env *environment.Environment, envManager environment.Manager, ...) ServiceTarget
- func NewAksTarget(env *environment.Environment, envManager environment.Manager, ...) ServiceTarget
- func NewAppServiceTarget(env *environment.Environment, azCli *azapi.AzureClient) ServiceTarget
- func NewContainerAppTarget(env *environment.Environment, envManager environment.Manager, ...) ServiceTarget
- func NewDotNetContainerAppTarget(env *environment.Environment, containerHelper *ContainerHelper, ...) ServiceTarget
- func NewFunctionAppTarget(env *environment.Environment, azCli *azapi.AzureClient) ServiceTarget
- func NewSpringAppTarget(env *environment.Environment, envManager environment.Manager, ...) ServiceTarget
- func NewStaticWebAppTarget(env *environment.Environment, azCli *azapi.AzureClient, swaCli *swa.Cli) ServiceTarget
- type ServiceTargetKind
- type SpringOptions
Constants ¶
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" )
const ( DefaultModule = "main" DefaultPath = "infra" )
defaultOptions for infra settings. These values are applied across provisioning providers.
const ( ProjectEventDeploy ext.Event = "deploy" ProjectEventProvision ext.Event = "provision" )
const ( ServiceEventEnvUpdated ext.Event = "environment updated" ServiceEventRestore ext.Event = "restore" ServiceEventBuild ext.Event = "build" ServiceEventPackage ext.Event = "package" ServiceEventDeploy ext.Event = "deploy" )
const AppServiceJavaPackageName = "app"
The default, conventional App Service Java package name
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
const DefaultStaticWebAppEnvironmentName = "default"
TODO: Enhance for multi-environment support https://github.com/Azure/azure-dev/issues/1152
Variables ¶
var ( ProjectEvents []ext.Event = []ext.Event{ ProjectEventProvision, ProjectEventDeploy, } ErrNoDefaultService = errors.New("no default service selection matches the working directory") )
var ( ServiceEvents []ext.Event = []ext.Event{ ServiceEventEnvUpdated, ServiceEventRestore, ServiceEventPackage, ServiceEventDeploy, } )
Functions ¶
func LoadConfig ¶
func OverriddenEndpoints ¶
func OverriddenEndpoints(ctx context.Context, serviceConfig *ServiceConfig, env *environment.Environment) []string
Types ¶
type AIModelProps ¶
type AIModelProps struct {
Model AIModelPropsModel `yaml:"model,omitempty"`
}
type AIModelPropsModel ¶
type AiEndpointDeploymentResult ¶
type AiEndpointDeploymentResult struct { Environment *armmachinelearning.EnvironmentVersion Model *armmachinelearning.ModelVersion Flow *ai.Flow Deployment *armmachinelearning.OnlineDeployment }
AiEndpointDeploymentResult is a struct to hold the result of an online endpoint deployment
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 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 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 ContainerHelper ¶
type ContainerHelper struct {
// contains filtered or unexported fields
}
func NewContainerHelper ¶
func NewContainerHelper( env *environment.Environment, envManager environment.Manager, clock clock.Clock, containerRegistryService azapi.ContainerRegistryService, remoteBuildManager *containerregistry.RemoteBuildManager, docker *docker.Cli, dotNetCli *dotnet.Cli, console input.Console, cloud *cloud.Cloud, ) *ContainerHelper
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(serviceConfig *ServiceConfig) string
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) Deploy ¶
func (ch *ContainerHelper) Deploy( ctx context.Context, serviceConfig *ServiceConfig, packageOutput *ServicePackageResult, targetResource *environment.TargetResource, writeImageToEnv bool, progress *async.Progress[ServiceProgress], ) (*ServiceDeployResult, error)
Deploy pushes and image to a remote server, and optionally writes the fully qualified remote image name to the environment on success.
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) 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, ) (string, error)
RemoteImageTag returns the remote image tag for the service configuration.
func (*ContainerHelper) RequiredExternalTools ¶
func (ch *ContainerHelper) RequiredExternalTools(ctx context.Context, serviceConfig *ServiceConfig) []tools.ExternalTool
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:"-"` }
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 ¶
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) 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)
func (*DotNetImporter) SynthAllInfrastructure ¶
func (ai *DotNetImporter) SynthAllInfrastructure(ctx context.Context, p *ProjectConfig, svcConfig *ServiceConfig, ) (fs.FS, error)
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, progress *async.Progress[ServiceProgress], ) (*ServiceRestoreResult, error) // Builds the source for the framework service Build( ctx context.Context, serviceConfig *ServiceConfig, restoreOutput *ServiceRestoreResult, 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, buildOutput *ServiceBuildResult, 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 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 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) 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.
func (*ImportManager) SynthAllInfrastructure ¶
func (im *ImportManager) SynthAllInfrastructure(ctx context.Context, projectConfig *ProjectConfig) (fs.FS, error)
SynthAllInfrastructure returns a file system containing all infrastructure for the project, rooted at the project directory.
type Infra ¶
type Infra struct { Options provisioning.Options // 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.
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"` *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
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 RequiredVersions ¶
type RequiredVersions struct { // When non nil, a semver range (in the format expected by semver.ParseRange). Azd *string `yaml:"azd,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:"-"` // The properties for the resource RawProps map[string]yaml.Node `yaml:",inline"` Props interface{} `yaml:"-"` // Relationships to other resources Uses []string `yaml:"uses,omitempty"` }
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.Resource, error) GetServiceResource( ctx context.Context, subscriptionId string, resourceGroupName string, serviceConfig *ServiceConfig, rerunCommand string, ) (*azapi.Resource, 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" ResourceTypeDbMongo ResourceType = "db.mongo" ResourceTypeHostContainerApp ResourceType = "host.containerapp" ResourceTypeOpenAiModel ResourceType = "ai.openai.model" )
func AllResourceTypes ¶
func AllResourceTypes() []ResourceType
func (ResourceType) String ¶
func (r ResourceType) String() string
type ServiceBuildResult ¶
type ServiceBuildResult struct { Restore *ServiceRestoreResult `json:"restore"` BuildOutputPath string `json:"buildOutputPath"` Details interface{} `json:"details"` }
ServiceBuildResult is the result of a successful Build operation
func (*ServiceBuildResult) MarshalJSON ¶
func (sbr *ServiceBuildResult) MarshalJSON() ([]byte, error)
func (*ServiceBuildResult) ToString ¶
func (sbr *ServiceBuildResult) ToString(currentIndentation string) string
Supports rendering messages for UX items
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"` // The optional Azure Spring Apps options Spring SpringOptions `yaml:"spring,omitempty"` // The infrastructure provisioning configuration Infra provisioning.Options `yaml:"infra,omitempty"` // Hook configuration for service Hooks HooksConfig `yaml:"hooks,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"` *ext.EventDispatcher[ServiceLifecycleEventArgs] `yaml:"-"` // contains filtered or unexported fields }
func (*ServiceConfig) Path ¶
func (sc *ServiceConfig) Path() string
Path returns the fully qualified path to the project
type ServiceDeployResult ¶
type ServiceDeployResult struct { Package *ServicePackageResult `json:"package"` // Related Azure resource ID TargetResourceId string `json:"targetResourceId"` Kind ServiceTargetKind `json:"kind"` Endpoints []string `json:"endpoints"` Details interface{} `json:"details"` }
ServiceDeployResult is the result of a successful Deploy operation
func NewServiceDeployResult ¶
func NewServiceDeployResult( relatedResourceId string, kind ServiceTargetKind, rawResult string, endpoints []string, ) *ServiceDeployResult
NewServiceDeployResult is a helper function to create a new ServiceDeployResult
func (*ServiceDeployResult) MarshalJSON ¶
func (spr *ServiceDeployResult) MarshalJSON() ([]byte, error)
func (*ServiceDeployResult) ToString ¶
func (spr *ServiceDeployResult) ToString(currentIndentation string) string
Supports rendering messages for UX items
type ServiceEnvVar ¶
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" )
func (ServiceLanguageKind) IsDotNet ¶
func (slk ServiceLanguageKind) IsDotNet() bool
type ServiceLifecycleEventArgs ¶
type ServiceLifecycleEventArgs struct { Project *ProjectConfig Service *ServiceConfig 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, 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, restoreOutput *ServiceRestoreResult, 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, buildOutput *ServiceBuildResult, progress *async.Progress[ServiceProgress], options *PackageOptions, ) (*ServicePackageResult, 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. Deploy( ctx context.Context, serviceConfig *ServiceConfig, packageOutput *ServicePackageResult, progress *async.Progress[ServiceProgress], ) (*ServiceDeployResult, 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 ¶
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 { Build *ServiceBuildResult `json:"build"` PackagePath string `json:"packagePath"` Details interface{} `json:"details"` }
ServicePackageResult is the result of a successful Package operation
func (*ServicePackageResult) MarshalJSON ¶
func (spr *ServicePackageResult) MarshalJSON() ([]byte, error)
func (*ServicePackageResult) ToString ¶
func (spr *ServicePackageResult) ToString(currentIndentation string) string
Supports rendering messages for UX items
type ServiceProgress ¶
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 ServiceRestoreResult ¶
type ServiceRestoreResult struct {
Details interface{} `json:"details"`
}
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, frameworkPackageOutput *ServicePackageResult, progress *async.Progress[ServiceProgress], ) (*ServicePackageResult, error) // Deploys the given deployment artifact to the target resource Deploy( ctx context.Context, serviceConfig *ServiceConfig, servicePackage *ServicePackageResult, 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, ) 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, ) 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, ) 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 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, springService azapi.SpringService, ) ServiceTarget
NewSpringAppTarget creates the spring app service target.
The target resource can be partially filled with only ResourceGroupName, since spring apps can be provisioned during deployment.
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 (ServiceTargetKind) RequiresContainer ¶
func (stk ServiceTargetKind) RequiresContainer() bool
RequiresContainer returns true if the service target runs a container image.
func (ServiceTargetKind) SupportsDelayedProvisioning ¶
func (st ServiceTargetKind) SupportsDelayedProvisioning() bool
SupportsDelayedProvisioning returns true if the service target kind supports delayed provisioning resources at deployment time, otherwise false.
As an example, ContainerAppTarget is able to provision the container app as part of deployment, and thus returns true.
type SpringOptions ¶
type SpringOptions struct { // The deployment name of ASA app DeploymentName string `yaml:"deploymentName"` }
The Azure Spring Apps configuration options
Source Files ¶
- ai_helper.go
- container_helper.go
- dotnet_importer.go
- framework_service.go
- framework_service_docker.go
- framework_service_dotnet.go
- framework_service_maven.go
- framework_service_noop.go
- framework_service_npm.go
- framework_service_python.go
- framework_service_swa.go
- importer.go
- project.go
- project_config.go
- project_manager.go
- project_utils.go
- resource_manager.go
- resources.go
- scaffold_gen.go
- scaffold_gen_util.go
- service_config.go
- service_manager.go
- service_models.go
- service_target.go
- service_target_ai_endpoint.go
- service_target_aks.go
- service_target_appservice.go
- service_target_containerapp.go
- service_target_dotnet_containerapp.go
- service_target_functionapp.go
- service_target_springapp.go
- service_target_staticwebapp.go