Documentation ¶
Index ¶
- Constants
- Variables
- func NewEnvironmentStore(config *Config, devCenterClient devcentersdk.DevCenterClient, ...) environment.RemoteDataStore
- func NewPlatform(config *platform.Config) platform.Provider
- func NewProvisionProvider(console input.Console, env *environment.Environment, ...) provisioning.Provider
- func NewTemplateSource(config *Config, manager Manager, devCenterClient devcentersdk.DevCenterClient) templates.Source
- type Config
- type DeploymentFilterPredicate
- type DevCenterFilterPredicate
- type EnvironmentDefinitionFilterPredicate
- type EnvironmentFilterPredicate
- type EnvironmentStore
- func (s *EnvironmentStore) ConfigPath(env *environment.Environment) string
- func (s *EnvironmentStore) Delete(ctx context.Context, name string) error
- func (s *EnvironmentStore) EnvPath(env *environment.Environment) string
- func (s *EnvironmentStore) Get(ctx context.Context, name string) (*environment.Environment, error)
- func (s *EnvironmentStore) List(ctx context.Context) ([]*contracts.EnvListEnvironment, error)
- func (s *EnvironmentStore) Reload(ctx context.Context, env *environment.Environment) error
- func (s *EnvironmentStore) Save(ctx context.Context, env *environment.Environment, ...) error
- type Manager
- type Platform
- type ProjectFilterPredicate
- type Prompter
- func (p *Prompter) PromptEnvironmentDefinition(ctx context.Context, devCenterName, projectName string) (*devcentersdk.EnvironmentDefinition, error)
- func (p *Prompter) PromptEnvironmentType(ctx context.Context, devCenterName string, projectName string) (*devcentersdk.EnvironmentType, error)
- func (p *Prompter) PromptForConfig(ctx context.Context, config *Config) error
- func (p *Prompter) PromptParameters(ctx context.Context, env *environment.Environment, ...) (map[string]any, error)
- func (p *Prompter) PromptProject(ctx context.Context, devCenterName string) (*devcentersdk.Project, error)
- type ProvisionProvider
- func (p *ProvisionProvider) Deploy(ctx context.Context) (*provisioning.DeployResult, error)
- func (p *ProvisionProvider) Destroy(ctx context.Context, options provisioning.DestroyOptions) (*provisioning.DestroyResult, error)
- func (p *ProvisionProvider) EnsureEnv(ctx context.Context) error
- func (p *ProvisionProvider) Initialize(ctx context.Context, projectPath string, options provisioning.Options) error
- func (p *ProvisionProvider) Name() string
- func (p *ProvisionProvider) Preview(ctx context.Context) (*provisioning.DeployPreviewResult, error)
- func (p *ProvisionProvider) State(ctx context.Context, options *provisioning.StateOptions) (*provisioning.StateResult, error)
- type TemplateSource
Constants ¶
const ( // Environment variable names DevCenterNameEnvName = "AZURE_DEVCENTER_NAME" DevCenterCatalogEnvName = "AZURE_DEVCENTER_CATALOG" DevCenterProjectEnvName = "AZURE_DEVCENTER_PROJECT" DevCenterEnvTypeEnvName = "AZURE_DEVCENTER_ENVIRONMENT_TYPE" DevCenterEnvDefinitionEnvName = "AZURE_DEVCENTER_ENVIRONMENT_DEFINITION" DevCenterEnvUser = "AZURE_DEVCENTER_ENVIRONMENT_USER" // Environment configuration paths DevCenterNamePath = ConfigPath + ".name" DevCenterCatalogPath = ConfigPath + ".catalog" DevCenterProjectPath = ConfigPath + ".project" DevCenterEnvTypePath = ConfigPath + ".environmentType" DevCenterEnvDefinitionPath = ConfigPath + ".environmentDefinition" DevCenterUserPath = ConfigPath + ".user" PlatformKindDevCenter platform.PlatformKind = "devcenter" )
const ( ConfigPath = "platform.config" RemoteKindDevCenter environment.RemoteKind = "devcenter" )
const ( ProvisionParametersConfigPath string = "provision.parameters" ProvisionKindDevCenter provisioning.ProviderKind = "devcenter" // ADE environment ARM deployment tags DeploymentTagDevCenterName = "AdeDevCenterName" DeploymentTagDevCenterProject = "AdeProjectName" DeploymentTagEnvironmentType = "AdeEnvironmentTypeName" DeploymentTagEnvironmentName = "AdeEnvironmentName" )
const (
SourceKindDevCenter templates.SourceKind = "devcenter"
)
Variables ¶
var SourceDevCenter = &templates.SourceConfig{ Key: "devcenter", Name: "Dev Center", Type: SourceKindDevCenter, }
Functions ¶
func NewEnvironmentStore ¶
func NewEnvironmentStore( config *Config, devCenterClient devcentersdk.DevCenterClient, prompter *Prompter, manager Manager, local environment.LocalDataStore, ) environment.RemoteDataStore
NewEnvironmentStore creates a new devcenter environment store
func NewProvisionProvider ¶
func NewProvisionProvider( console input.Console, env *environment.Environment, envManager environment.Manager, config *Config, devCenterClient devcentersdk.DevCenterClient, deploymentManager *infra.DeploymentManager, manager Manager, prompter *Prompter, ) provisioning.Provider
NewProvisionProvider creates a new devcenter provider
func NewTemplateSource ¶
func NewTemplateSource(config *Config, manager Manager, devCenterClient devcentersdk.DevCenterClient) templates.Source
Types ¶
type Config ¶
type Config struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Catalog string `json:"catalog,omitempty" yaml:"catalog,omitempty"` Project string `json:"project,omitempty" yaml:"project,omitempty"` EnvironmentType string `json:"environmentType,omitempty" yaml:"environmentType,omitempty"` EnvironmentDefinition string `json:"environmentDefinition,omitempty" yaml:"environmentDefinition,omitempty"` User string `json:"user,omitempty" yaml:"user,omitempty"` }
Config provides the Azure DevCenter configuration used for devcenter enabled projects
func MergeConfigs ¶
Merges supplemental configuration into the base config only if the key/value doesn't already exist in the base config Example: If the base config is a fully configured object, then any supplemental configuration will be ignored
func ParseConfig ¶
ParseConfig attempts to parse a partial JSON configuration into a devcenter configuration
func (*Config) EnsureValid ¶
EnsureValid ensures the devcenter configuration is valid to continue with provisioning
type DeploymentFilterPredicate ¶
type DeploymentFilterPredicate func(d *azapi.ResourceDeployment) bool
DeploymentFilterPredicate is a predicate function for filtering deployments
type DevCenterFilterPredicate ¶
type DevCenterFilterPredicate func(dc *devcentersdk.DevCenter) bool
DevCenterFilterPredicate is a predicate function for filtering dev centers
type EnvironmentDefinitionFilterPredicate ¶
type EnvironmentDefinitionFilterPredicate func(ed *devcentersdk.EnvironmentDefinition) bool
EnvironmentDefinitionFilterPredicate is a predicate function for filtering environment definitions
type EnvironmentFilterPredicate ¶
type EnvironmentFilterPredicate func(e *devcentersdk.Environment) bool
EnvironmentFilterPredicate is a predicate function for filtering environments
type EnvironmentStore ¶
type EnvironmentStore struct {
// contains filtered or unexported fields
}
EnvironmentStore is a remote environment data store for devcenter environments
func (*EnvironmentStore) ConfigPath ¶
func (s *EnvironmentStore) ConfigPath(env *environment.Environment) string
ConfigPath returns the path for the environment configuration
func (*EnvironmentStore) Delete ¶
func (s *EnvironmentStore) Delete(ctx context.Context, name string) error
Delete implements environment.RemoteDataStore. Since the remote data store doesn't store environment configuration / metadata, we only delete the local storage.
func (*EnvironmentStore) EnvPath ¶
func (s *EnvironmentStore) EnvPath(env *environment.Environment) string
EnvPath returns the path for the environment
func (*EnvironmentStore) Get ¶
func (s *EnvironmentStore) Get(ctx context.Context, name string) (*environment.Environment, error)
Get returns the environment for the given name
func (*EnvironmentStore) List ¶
func (s *EnvironmentStore) List(ctx context.Context) ([]*contracts.EnvListEnvironment, error)
List returns a list of environments for the devcenter configuration
func (*EnvironmentStore) Reload ¶
func (s *EnvironmentStore) Reload(ctx context.Context, env *environment.Environment) error
Reload reloads the environment from the remote data store
func (*EnvironmentStore) Save ¶
func (s *EnvironmentStore) Save(ctx context.Context, env *environment.Environment, options *environment.SaveOptions) error
Save saves the environment to the remote data store DevCenter doesn't implement any APIs for saving environment configuration / metadata outside of the environment definition itself or the ARM deployment outputs
type Manager ¶
type Manager interface { // WritableProjects gets a list of ADE projects that a user has write permissions WritableProjects(ctx context.Context) ([]*devcentersdk.Project, error) // WritableProjectsWithFilter gets a list of ADE projects that a user has write permissions for deployment WritableProjectsWithFilter( ctx context.Context, devCenterFilter DevCenterFilterPredicate, projectFilter ProjectFilterPredicate, ) ([]*devcentersdk.Project, error) // Deployment gets the Resource Group scoped deployment for the specified devcenter environment Deployment( ctx context.Context, config *Config, env *devcentersdk.Environment, filter DeploymentFilterPredicate, ) (infra.Deployment, error) // LatestArmDeployment gets the latest ARM deployment for the specified devcenter environment LatestArmDeployment( ctx context.Context, config *Config, env *devcentersdk.Environment, filter DeploymentFilterPredicate, ) (*azapi.ResourceDeployment, error) // Outputs gets the outputs for the specified devcenter environment Outputs( ctx context.Context, config *Config, env *devcentersdk.Environment, ) (map[string]provisioning.OutputParameter, error) }
func NewManager ¶
func NewManager( client devcentersdk.DevCenterClient, deploymentManager *infra.DeploymentManager, ) Manager
NewManager creates a new devcenter manager
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform manages the Azd configuration of the devcenter platform
func (*Platform) ConfigureContainer ¶
func (p *Platform) ConfigureContainer(container *ioc.NestedContainer) error
ConfigureContainer configures the IoC container for the devcenter platform components
type ProjectFilterPredicate ¶
type ProjectFilterPredicate func(p *devcentersdk.Project) bool
ProjectFilterPredicate is a predicate function for filtering projects
type Prompter ¶
type Prompter struct {
// contains filtered or unexported fields
}
Prompter provides a common set of methods for prompting the user for devcenter configuration values
func NewPrompter ¶
func NewPrompter( console input.Console, manager Manager, devCenterClient devcentersdk.DevCenterClient, ) *Prompter
NewPrompter creates a new devcenter prompter
func (*Prompter) PromptEnvironmentDefinition ¶
func (p *Prompter) PromptEnvironmentDefinition( ctx context.Context, devCenterName, projectName string, ) (*devcentersdk.EnvironmentDefinition, error)
PromptEnvironmentDefinition prompts the user to select an environment definition for the specified devcenter and project
func (*Prompter) PromptEnvironmentType ¶
func (p *Prompter) PromptEnvironmentType( ctx context.Context, devCenterName string, projectName string, ) (*devcentersdk.EnvironmentType, error)
PromptEnvironmentType prompts the user to select an environment type for the specified devcenter and project If the user only has access to a single environment type, then that environment type will be returned
func (*Prompter) PromptForConfig ¶
PromptForConfig prompts the user for devcenter configuration values that have not been previously set
func (*Prompter) PromptParameters ¶
func (p *Prompter) PromptParameters( ctx context.Context, env *environment.Environment, envDef *devcentersdk.EnvironmentDefinition, ) (map[string]any, error)
Prompts the user for values defined within the environment definition parameters Responses for prompt are stored in azd environment configuration and used for future provisioning operations
func (*Prompter) PromptProject ¶
func (p *Prompter) PromptProject(ctx context.Context, devCenterName string) (*devcentersdk.Project, error)
PromptProject prompts the user to select a project for the specified devcenter If the user only has access to a single project, then that project will be returned
type ProvisionProvider ¶
type ProvisionProvider struct {
// contains filtered or unexported fields
}
ProvisionProvider is a devcenter provider for provisioning ADE environments
func (*ProvisionProvider) Deploy ¶
func (p *ProvisionProvider) Deploy(ctx context.Context) (*provisioning.DeployResult, error)
Deploy deploys the environment from the configured environment definition
func (*ProvisionProvider) Destroy ¶
func (p *ProvisionProvider) Destroy( ctx context.Context, options provisioning.DestroyOptions, ) (*provisioning.DestroyResult, error)
Destroy destroys the environment by deleting the ADE environment
func (*ProvisionProvider) EnsureEnv ¶
func (p *ProvisionProvider) EnsureEnv(ctx context.Context) error
EnsureEnv ensures that the environment is configured for the Dev Center provider. Require selection for devcenter, project, catalog, environment type, and environment definition
func (*ProvisionProvider) Initialize ¶
func (p *ProvisionProvider) Initialize(ctx context.Context, projectPath string, options provisioning.Options) error
Initialize initializes the provider
func (*ProvisionProvider) Name ¶
func (p *ProvisionProvider) Name() string
Name returns the name of the provider
func (*ProvisionProvider) Preview ¶
func (p *ProvisionProvider) Preview(ctx context.Context) (*provisioning.DeployPreviewResult, error)
Preview previews the deployment of the environment from the configured environment definition
func (*ProvisionProvider) State ¶
func (p *ProvisionProvider) State( ctx context.Context, options *provisioning.StateOptions, ) (*provisioning.StateResult, error)
State returns the state of the environment from the most recent ARM deployment
type TemplateSource ¶
type TemplateSource struct {
// contains filtered or unexported fields
}
func (*TemplateSource) GetTemplate ¶
func (*TemplateSource) ListTemplates ¶
func (*TemplateSource) Name ¶
func (s *TemplateSource) Name() string