provisioning

package
v0.0.0-...-173a1fd Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeploymentsNotFound = errors.New("no deployments found")
)

Functions

func EnsureSubscriptionAndLocation

func EnsureSubscriptionAndLocation(
	ctx context.Context,
	envManager environment.Manager,
	env *environment.Environment,
	prompter prompt.Prompter,
	locationFiler prompt.LocationFilterPredicate,
) error

EnsureSubscriptionAndLocation ensures that that that subscription (AZURE_SUBSCRIPTION_ID) and location (AZURE_LOCATION) variables are set in the environment, prompting the user for the values if they do not exist. locationFilter, when non-nil, filters the locations being displayed.

func NewEnvRefreshResultFromState

func NewEnvRefreshResultFromState(state *State) contracts.EnvRefreshResult

NewEnvRefreshResultFromState creates a EnvRefreshResult from a provisioning state object, applying the required translations.

Types

type ActionOptions

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

func NewActionOptions

func NewActionOptions(formatter output.Formatter, interactive bool) ActionOptions

func (*ActionOptions) Formatter

func (options *ActionOptions) Formatter() output.Formatter

Gets the specified output format

func (*ActionOptions) IsInteractive

func (options *ActionOptions) IsInteractive() bool

Gets a value determining whether the console is interactive Console is only considered interactive when the interactive flag has been set and an output format has not been defined.

type ChangeType

type ChangeType string

ChangeType defines a type for the valid changes for an Azure resource.

const (
	ChangeTypeCreate      ChangeType = "Create"
	ChangeTypeDelete      ChangeType = "Delete"
	ChangeTypeDeploy      ChangeType = "Deploy"
	ChangeTypeIgnore      ChangeType = "Ignore"
	ChangeTypeModify      ChangeType = "Modify"
	ChangeTypeNoChange    ChangeType = "NoChange"
	ChangeTypeUnsupported ChangeType = "Unsupported"
)

type CurrentPrincipalIdProvider

type CurrentPrincipalIdProvider interface {
	// CurrentPrincipalId returns the object id of the current logged in principal, or an error if it can not be
	// determined.
	CurrentPrincipalId(ctx context.Context) (string, error)
}

func NewPrincipalIdProvider

func NewPrincipalIdProvider(
	env *environment.Environment,
	userProfileService *azcli.UserProfileService,
	subResolver account.SubscriptionTenantResolver,
) CurrentPrincipalIdProvider

type DefaultProviderResolver

type DefaultProviderResolver func() (ProviderKind, error)

type DeployPreviewResult

type DeployPreviewResult struct {
	Preview *DeploymentPreview
}

DeployPreviewResult defines one deployment in preview mode, displaying what changes would it be performed, without applying the changes.

type DeployResult

type DeployResult struct {
	Deployment    *Deployment
	SkippedReason SkippedReasonType
}

type Deployment

type Deployment struct {
	Parameters map[string]InputParameter
	Outputs    map[string]OutputParameter
}

type DeploymentPreview

type DeploymentPreview struct {
	Status     string
	Properties *DeploymentPreviewProperties
}

DeploymentPreview defines the general structure for a deployment preview regardless of the deployment provider.

type DeploymentPreviewChange

type DeploymentPreviewChange struct {
	ChangeType        ChangeType
	ResourceId        Resource
	ResourceType      string
	Name              string
	UnsupportedReason string
	Before            interface{}
	After             interface{}
	Delta             []DeploymentPreviewPropertyChange
}

DeploymentPreviewChange represents a change to one Azure resource.

type DeploymentPreviewProperties

type DeploymentPreviewProperties struct {
	Changes []*DeploymentPreviewChange
}

DeploymentPreviewProperties holds the changes for the deployment preview.

type DeploymentPreviewPropertyChange

type DeploymentPreviewPropertyChange struct {
	ChangeType PropertyChangeType
	Path       string
	Before     interface{}
	After      interface{}
	Children   []DeploymentPreviewPropertyChange
}

DeploymentPreviewPropertyChange includes the details and properties from a resource change.

type DestroyOptions

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

Infrastructure destroy options

func NewDestroyOptions

func NewDestroyOptions(force bool, purge bool) DestroyOptions

func (*DestroyOptions) Force

func (o *DestroyOptions) Force() bool

func (*DestroyOptions) Purge

func (o *DestroyOptions) Purge() bool

type DestroyResult

type DestroyResult struct {
	// InvalidatedEnvKeys is a list of keys that should be removed from the environment after the destroy is complete.
	InvalidatedEnvKeys []string
}

type InputParameter

type InputParameter struct {
	Type         string
	DefaultValue interface{}
	Value        interface{}
}

func (*InputParameter) HasDefaultValue

func (p *InputParameter) HasDefaultValue() bool

func (*InputParameter) HasValue

func (p *InputParameter) HasValue() bool

type Manager

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

Manages the orchestration of infrastructure provisioning

func NewManager

func NewManager(
	serviceLocator ioc.ServiceLocator,
	defaultProvider DefaultProviderResolver,
	envManager environment.Manager,
	env *environment.Environment,
	console input.Console,
	alphaFeatureManager *alpha.FeatureManager,
) *Manager

Creates a new instance of the Provisioning Manager

func (*Manager) Deploy

func (m *Manager) Deploy(ctx context.Context) (*DeployResult, error)

Deploys the Azure infrastructure for the specified project

func (*Manager) Destroy

func (m *Manager) Destroy(ctx context.Context, options DestroyOptions) (*DestroyResult, error)

Destroys the Azure infrastructure for the specified project

func (*Manager) Initialize

func (m *Manager) Initialize(ctx context.Context, projectPath string, options Options) error

func (*Manager) Preview

func (m *Manager) Preview(ctx context.Context) (*DeployPreviewResult, error)

Preview generates the list of changes to be applied as part of the provisioning.

func (*Manager) State

func (m *Manager) State(ctx context.Context, options *StateOptions) (*StateResult, error)

Gets the latest deployment details for the specified scope

func (*Manager) UpdateEnvironment

func (m *Manager) UpdateEnvironment(
	ctx context.Context,
	outputs map[string]OutputParameter,
) error

type Options

type Options struct {
	Provider ProviderKind `yaml:"provider,omitempty"`
	Path     string       `yaml:"path,omitempty"`
	Module   string       `yaml:"module,omitempty"`
	// Not expected to be defined at azure.yaml
	IgnoreDeploymentState bool `yaml:"-"`
}

type OutputParameter

type OutputParameter struct {
	Type  ParameterType
	Value interface{}
}

type ParameterType

type ParameterType string
const (
	ParameterTypeString  ParameterType = "string"
	ParameterTypeNumber  ParameterType = "number"
	ParameterTypeBoolean ParameterType = "bool"
	ParameterTypeObject  ParameterType = "object"
	ParameterTypeArray   ParameterType = "array"
)

type PropertyChangeType

type PropertyChangeType string

PropertyChangeType defines a type for the valid properties of a change.

const (
	PropertyChangeTypeArray    PropertyChangeType = "Array"
	PropertyChangeTypeCreate   PropertyChangeType = "Create"
	PropertyChangeTypeDelete   PropertyChangeType = "Delete"
	PropertyChangeTypeModify   PropertyChangeType = "Modify"
	PropertyChangeTypeNoEffect PropertyChangeType = "NoEffect"
)

type Provider

type Provider interface {
	Name() string
	Initialize(ctx context.Context, projectPath string, options Options) error
	State(ctx context.Context, options *StateOptions) (*StateResult, error)
	Deploy(ctx context.Context) (*DeployResult, error)
	Preview(ctx context.Context) (*DeployPreviewResult, error)
	Destroy(ctx context.Context, options DestroyOptions) (*DestroyResult, error)
	EnsureEnv(ctx context.Context) error
}

type ProviderKind

type ProviderKind string
const (
	NotSpecified ProviderKind = ""
	Bicep        ProviderKind = "bicep"
	Arm          ProviderKind = "arm"
	Terraform    ProviderKind = "terraform"
	Pulumi       ProviderKind = "pulumi"
	Test         ProviderKind = "test"
)

func ParseProvider

func ParseProvider(kind ProviderKind) (ProviderKind, error)

Parses the specified IaC Provider to ensure whether it is valid or not Defaults to `Bicep` if no provider is specified

type ProvisioningProgressDisplay

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

ProvisioningProgressDisplay displays interactive progress for an ongoing Azure provisioning operation.

func NewProvisioningProgressDisplay

func NewProvisioningProgressDisplay(
	rm infra.ResourceManager,
	console input.Console,
	target infra.Deployment,
) ProvisioningProgressDisplay

func (*ProvisioningProgressDisplay) ReportProgress

func (display *ProvisioningProgressDisplay) ReportProgress(
	ctx context.Context, queryStart *time.Time) error

ReportProgress reports the current deployment progress, setting the currently executing operation title and logging progress.

type Resource

type Resource struct {
	Id string
}

type SkippedReasonType

type SkippedReasonType string
const DeploymentStateSkipped SkippedReasonType = "deployment State"

type State

type State struct {
	// Outputs from the most recent deployment.
	Outputs map[string]OutputParameter
	// The resources that make up the application.
	Resources []Resource
}

State represents the "current state" of the infrastructure, which is the result of the most recent deployment. For ARM this corresponds to information from the most recent deployment object. For Terraform, it's information from the state file.

type StateOptions

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

func NewStateOptions

func NewStateOptions(hint string) *StateOptions

func (*StateOptions) Hint

func (o *StateOptions) Hint() string

type StateResult

type StateResult struct {
	State *State
}

Directories

Path Synopsis
Package test contains an test implementation of provider.Provider.
Package test contains an test implementation of provider.Provider.

Jump to

Keyboard shortcuts

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