azapi

package
v0.0.0-...-88ad9bc Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAzCliNotLoggedIn         = errors.New("cli is not logged in. Try running \"az login\" to fix")
	ErrAzCliRefreshTokenExpired = errors.New("refresh token has expired. Try running \"az login\" to fix")
)
View Source
var (
	ErrDeploymentNotFound = errors.New("deployment not found")
)
View Source
var ErrPreviewNotSupported = errors.New("preview not supported")
View Source
var FeatureDeploymentStacks = alpha.MustFeatureKey("deployment.stacks")

Functions

func CreateDeploymentOutput

func CreateDeploymentOutput(rawOutputs interface{}) (result map[string]AzCliDeploymentOutput)

convert from: sdk client outputs: interface{} to map[string]azapi.AzCliDeploymentOutput sdk client parses http response from network as an interface{} this function keeps the compatibility with the previous AzCliDeploymentOutput model

func GetResourceTypeDisplayName

func GetResourceTypeDisplayName(resourceType AzureResourceType) string

GetResourceTypeDisplayName retrieves the display name for the given resource type. If the display name was not found for the given resource type, an empty string is returned instead.

func GroupByResourceGroup

func GroupByResourceGroup(resources []*armresources.ResourceReference) (map[string][]*Resource, error)

GroupByResourceGroup creates a map of resources group by their resource group name. The key is the resource group name and the value is a list of resources in that group.

Types

type AzCliAccessToken

type AzCliAccessToken struct {
	AccessToken string
	ExpiresOn   *time.Time
}

AzCliAccessToken represents the value returned by `az account get-access-token`

type AzCliApim

type AzCliApim struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	Location string `json:"location"`
}

type AzCliAppConfig

type AzCliAppConfig struct {
	Id         string `json:"id"`
	Name       string `json:"name"`
	Location   string `json:"location"`
	Properties struct {
		EnablePurgeProtection bool `json:"enablePurgeProtection"`
	} `json:"properties"`
}

type AzCliAppServiceProperties

type AzCliAppServiceProperties struct {
	HostNames []string
}

type AzCliDeployment

type AzCliDeployment struct {
	Id         string                    `json:"id"`
	Name       string                    `json:"name"`
	Properties AzCliDeploymentProperties `json:"properties"`
}

type AzCliDeploymentAdditionalInfo

type AzCliDeploymentAdditionalInfo struct {
	Type string      `json:"type"`
	Info interface{} `json:"info"`
}

type AzCliDeploymentErrorResponse

type AzCliDeploymentErrorResponse struct {
	Code           string                         `json:"code"`
	Message        string                         `json:"message"`
	Target         string                         `json:"target"`
	Details        []AzCliDeploymentErrorResponse `json:"details"`
	AdditionalInfo AzCliDeploymentAdditionalInfo  `json:"additionalInfo"`
}

type AzCliDeploymentOutput

type AzCliDeploymentOutput struct {
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

type AzCliDeploymentProperties

type AzCliDeploymentProperties struct {
	CorrelationId   string                                `json:"correlationId"`
	Error           AzCliDeploymentErrorResponse          `json:"error"`
	Dependencies    []AzCliDeploymentPropertiesDependency `json:"dependencies"`
	OutputResources []AzCliDeploymentResourceReference    `json:"outputResources"`
	Outputs         map[string]AzCliDeploymentOutput      `json:"outputs"`
}

type AzCliDeploymentPropertiesBasicDependency

type AzCliDeploymentPropertiesBasicDependency struct {
	Id           string `json:"id"`
	ResourceName string `json:"resourceName"`
	ResourceType string `json:"resourceType"`
}

type AzCliDeploymentPropertiesDependency

type AzCliDeploymentPropertiesDependency struct {
	AzCliDeploymentPropertiesBasicDependency
	DependsOn []AzCliDeploymentPropertiesBasicDependency `json:"dependsOn"`
}

type AzCliDeploymentResourceReference

type AzCliDeploymentResourceReference struct {
	Id string `json:"id"`
}

type AzCliDeploymentResult

type AzCliDeploymentResult struct {
	Properties AzCliDeploymentResultProperties `json:"properties"`
}

type AzCliDeploymentResultProperties

type AzCliDeploymentResultProperties struct {
	Outputs map[string]AzCliDeploymentOutput `json:"outputs"`
}

type AzCliDeploymentStatusMessage

type AzCliDeploymentStatusMessage struct {
	Err    AzCliDeploymentErrorResponse `json:"error"`
	Status string                       `json:"status"`
}

type AzCliFunctionAppProperties

type AzCliFunctionAppProperties struct {
	HostNames []string
}

type AzCliManagedHSM

type AzCliManagedHSM struct {
	Id         string `json:"id"`
	Name       string `json:"name"`
	Location   string `json:"location"`
	Properties struct {
		EnableSoftDelete      bool `json:"enableSoftDelete"`
		EnablePurgeProtection bool `json:"enablePurgeProtection"`
	} `json:"properties"`
}

type AzCliResourceOperation

type AzCliResourceOperation struct {
	Id          string                           `json:"id"`
	OperationId string                           `json:"operationId"`
	Properties  AzCliResourceOperationProperties `json:"properties"`
}

type AzCliResourceOperationProperties

type AzCliResourceOperationProperties struct {
	ProvisioningOperation string                               `json:"provisioningOperation"`
	ProvisioningState     string                               `json:"provisioningState"`
	TargetResource        AzCliResourceOperationTargetResource `json:"targetResource"`
	StatusCode            string                               `json:"statusCode"`
	StatusMessage         AzCliDeploymentStatusMessage         `json:"statusMessage"`
	// While the operation is in progress, this timestamp effectively represents "InProgressTimestamp".
	// When the operation ends, this timestamp effectively represents "EndTimestamp".
	Timestamp time.Time `json:"timestamp"`
}

type AzCliResourceOperationTargetResource

type AzCliResourceOperationTargetResource struct {
	Id            string `json:"id"`
	ResourceType  string `json:"resourceType"`
	ResourceName  string `json:"resourceName"`
	ResourceGroup string `json:"resourceGroup"`
}

type AzCliStaticWebAppEnvironmentProperties

type AzCliStaticWebAppEnvironmentProperties struct {
	Hostname string
	Status   string
}

type AzCliStaticWebAppProperties

type AzCliStaticWebAppProperties struct {
	DefaultHostname string
}

type AzureClient

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

func NewAzureClient

func NewAzureClient(
	credentialProvider account.SubscriptionCredentialProvider,
	armClientOptions *arm.ClientOptions,
) *AzureClient

func (*AzureClient) DeployAppServiceZip

func (cli *AzureClient) DeployAppServiceZip(
	ctx context.Context,
	subscriptionId string,
	resourceGroup string,
	appName string,
	deployZipFile io.ReadSeeker,
	progressLog func(string),
) (*string, error)

func (*AzureClient) DeployFunctionAppUsingZipFile

func (cli *AzureClient) DeployFunctionAppUsingZipFile(
	ctx context.Context,
	subscriptionId string,
	resourceGroup string,
	appName string,
	deployZipFile io.ReadSeeker,
	remoteBuild bool,
) (*string, error)

func (*AzureClient) GetApim

func (cli *AzureClient) GetApim(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	apimName string,
) (*AzCliApim, error)

func (*AzureClient) GetAppConfig

func (cli *AzureClient) GetAppConfig(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	configName string,
) (*AzCliAppConfig, error)

func (*AzureClient) GetAppServiceProperties

func (cli *AzureClient) GetAppServiceProperties(
	ctx context.Context,
	subscriptionId string,
	resourceGroup string,
	appName string,
) (*AzCliAppServiceProperties, error)

func (*AzureClient) GetCognitiveAccount

func (cli *AzureClient) GetCognitiveAccount(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	accountName string) (armcognitiveservices.Account, error)

GetCognitiveAccount finds the cognitive account within a subscription

func (*AzureClient) GetFunctionAppProperties

func (cli *AzureClient) GetFunctionAppProperties(
	ctx context.Context,
	subscriptionId string,
	resourceGroup string,
	appName string,
) (*AzCliFunctionAppProperties, error)

func (*AzureClient) GetManagedHSM

func (cli *AzureClient) GetManagedHSM(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	hsmName string,
) (*AzCliManagedHSM, error)

func (*AzureClient) GetStaticWebAppApiKey

func (cli *AzureClient) GetStaticWebAppApiKey(
	ctx context.Context,
	subscriptionId string,
	resourceGroup string,
	appName string,
) (*string, error)

func (*AzureClient) GetStaticWebAppEnvironmentProperties

func (cli *AzureClient) GetStaticWebAppEnvironmentProperties(
	ctx context.Context,
	subscriptionId string,
	resourceGroup string,
	appName string,
	environmentName string,
) (*AzCliStaticWebAppEnvironmentProperties, error)

func (*AzureClient) GetStaticWebAppProperties

func (cli *AzureClient) GetStaticWebAppProperties(
	ctx context.Context,
	subscriptionId string,
	resourceGroup string,
	appName string,
) (*AzCliStaticWebAppProperties, error)

func (*AzureClient) PurgeApim

func (cli *AzureClient) PurgeApim(ctx context.Context, subscriptionId string, apimName string, location string) error

func (*AzureClient) PurgeAppConfig

func (cli *AzureClient) PurgeAppConfig(
	ctx context.Context,
	subscriptionId string,
	configName string,
	location string,
) error

func (*AzureClient) PurgeCognitiveAccount

func (cli *AzureClient) PurgeCognitiveAccount(
	ctx context.Context, subscriptionId, location, resourceGroup, accountName string) error

PurgeCognitiveAccount starts purge operation and wait until it is completed.

func (*AzureClient) PurgeManagedHSM

func (cli *AzureClient) PurgeManagedHSM(ctx context.Context, subscriptionId string, hsmName string, location string) error

type AzureDeploymentError

type AzureDeploymentError struct {
	Json string

	Details *DeploymentErrorLine
}

func NewAzureDeploymentError

func NewAzureDeploymentError(jsonErrorResponse string) *AzureDeploymentError

func (*AzureDeploymentError) Error

func (e *AzureDeploymentError) Error() string

type AzureResourceType

type AzureResourceType string
const (
	AzureResourceTypeApim                      AzureResourceType = "Microsoft.ApiManagement/service"
	AzureResourceTypeAppConfig                 AzureResourceType = "Microsoft.AppConfiguration/configurationStores"
	AzureResourceTypeAppInsightComponent       AzureResourceType = "Microsoft.Insights/components"
	AzureResourceTypeCacheForRedis             AzureResourceType = "Microsoft.Cache/redis"
	AzureResourceTypeCDNProfile                AzureResourceType = "Microsoft.Cdn/profiles"
	AzureResourceTypeCosmosDb                  AzureResourceType = "Microsoft.DocumentDB/databaseAccounts"
	AzureResourceTypeContainerApp              AzureResourceType = "Microsoft.App/containerApps"
	AzureResourceTypeSpringApp                 AzureResourceType = "Microsoft.AppPlatform/Spring"
	AzureResourceTypeContainerAppEnvironment   AzureResourceType = "Microsoft.App/managedEnvironments"
	AzureResourceTypeDeployment                AzureResourceType = "Microsoft.Resources/deployments"
	AzureResourceTypeKeyVault                  AzureResourceType = "Microsoft.KeyVault/vaults"
	AzureResourceTypeManagedHSM                AzureResourceType = "Microsoft.KeyVault/managedHSMs"
	AzureResourceTypeLoadTest                  AzureResourceType = "Microsoft.LoadTestService/loadTests"
	AzureResourceTypeLogAnalyticsWorkspace     AzureResourceType = "Microsoft.OperationalInsights/workspaces"
	AzureResourceTypePortalDashboard           AzureResourceType = "Microsoft.Portal/dashboards"
	AzureResourceTypePostgreSqlServer          AzureResourceType = "Microsoft.DBforPostgreSQL/flexibleServers"
	AzureResourceTypeMySqlServer               AzureResourceType = "Microsoft.DBforMySQL/flexibleServers"
	AzureResourceTypeResourceGroup             AzureResourceType = "Microsoft.Resources/resourceGroups"
	AzureResourceTypeStorageAccount            AzureResourceType = "Microsoft.Storage/storageAccounts"
	AzureResourceTypeStaticWebSite             AzureResourceType = "Microsoft.Web/staticSites"
	AzureResourceTypeServiceBusNamespace       AzureResourceType = "Microsoft.ServiceBus/namespaces"
	AzureResourceTypeServicePlan               AzureResourceType = "Microsoft.Web/serverfarms"
	AzureResourceTypeSqlServer                 AzureResourceType = "Microsoft.Sql/servers"
	AzureResourceTypeVirtualNetwork            AzureResourceType = "Microsoft.Network/virtualNetworks"
	AzureResourceTypeWebSite                   AzureResourceType = "Microsoft.Web/sites"
	AzureResourceTypeContainerRegistry         AzureResourceType = "Microsoft.ContainerRegistry/registries"
	AzureResourceTypeManagedCluster            AzureResourceType = "Microsoft.ContainerService/managedClusters"
	AzureResourceTypeAgentPool                 AzureResourceType = "Microsoft.ContainerService/managedClusters/agentPools"
	AzureResourceTypeCognitiveServiceAccount   AzureResourceType = "Microsoft.CognitiveServices/accounts"
	AzureResourceTypeSearchService             AzureResourceType = "Microsoft.Search/searchServices"
	AzureResourceTypeVideoIndexer              AzureResourceType = "Microsoft.VideoIndexer/accounts"
	AzureResourceTypePrivateEndpoint           AzureResourceType = "Microsoft.Network/privateEndpoints"
	AzureResourceTypeDevCenter                 AzureResourceType = "Microsoft.DevCenter/devcenters"
	AzureResourceTypeDevCenterProject          AzureResourceType = "Microsoft.DevCenter/projects"
	AzureResourceTypeMachineLearningWorkspace  AzureResourceType = "Microsoft.MachineLearningServices/workspaces"
	AzureResourceTypeMachineLearningConnection AzureResourceType = "Microsoft.MachineLearningServices/workspaces/connections"

	//nolint:lll
	AzureResourceTypeMachineLearningEndpoint           AzureResourceType = "Microsoft.MachineLearningServices/workspaces/onlineEndpoints"
	AzureResourceTypeCognitiveServiceAccountDeployment AzureResourceType = "Microsoft.CognitiveServices/accounts/deployments"
)

type ContainerRegistryService

type ContainerRegistryService interface {
	// Logs into the specified container registry
	Login(ctx context.Context, subscriptionId string, loginServer string) error
	// Gets the credentials that could be used to login to the specified container registry.
	Credentials(ctx context.Context, subscriptionId string, loginServer string) (*DockerCredentials, error)
	// Gets a list of container registries for the specified subscription
	GetContainerRegistries(ctx context.Context, subscriptionId string) ([]*armcontainerregistry.Registry, error)
}

ContainerRegistryService provides access to query and login to Azure Container Registries (ACR)

func NewContainerRegistryService

func NewContainerRegistryService(
	credentialProvider account.SubscriptionCredentialProvider,
	docker *docker.Cli,
	armClientOptions *arm.ClientOptions,
	coreClientOptions *azcore.ClientOptions,
) ContainerRegistryService

Creates a new instance of the ContainerRegistryService

type DeleteDeploymentProgress

type DeleteDeploymentProgress struct {
	Name    string
	Message string
	State   DeleteResourceState
}

type DeleteResourceState

type DeleteResourceState string
const (
	DeleteResourceStateInProgress DeleteResourceState = "InProgress"
	DeleteResourceStateSucceeded  DeleteResourceState = "Succeeded"
	DeleteResourceStateFailed     DeleteResourceState = "Failed"
)

type DeploymentErrorLine

type DeploymentErrorLine struct {
	// The code of the error line, if applicable
	Code string
	// The message that represents the error
	Message string
	// Inner errors
	Inner []*DeploymentErrorLine
}

type DeploymentProvisioningState

type DeploymentProvisioningState string
const (
	DeploymentProvisioningStateAccepted                DeploymentProvisioningState = "Accepted"
	DeploymentProvisioningStateCanceled                DeploymentProvisioningState = "Canceled"
	DeploymentProvisioningStateCanceling               DeploymentProvisioningState = "Canceling"
	DeploymentProvisioningStateCreating                DeploymentProvisioningState = "Creating"
	DeploymentProvisioningStateDeleted                 DeploymentProvisioningState = "Deleted"
	DeploymentProvisioningStateDeleting                DeploymentProvisioningState = "Deleting"
	DeploymentProvisioningStateDeletingResources       DeploymentProvisioningState = "DeletingResources"
	DeploymentProvisioningStateDeploying               DeploymentProvisioningState = "Deploying"
	DeploymentProvisioningStateFailed                  DeploymentProvisioningState = "Failed"
	DeploymentProvisioningStateNotSpecified            DeploymentProvisioningState = "NotSpecified"
	DeploymentProvisioningStateReady                   DeploymentProvisioningState = "Ready"
	DeploymentProvisioningStateRunning                 DeploymentProvisioningState = "Running"
	DeploymentProvisioningStateSucceeded               DeploymentProvisioningState = "Succeeded"
	DeploymentProvisioningStateUpdatingDenyAssignments DeploymentProvisioningState = "UpdatingDenyAssignments"
	DeploymentProvisioningStateValidating              DeploymentProvisioningState = "Validating"
	DeploymentProvisioningStateWaiting                 DeploymentProvisioningState = "Waiting"
	DeploymentProvisioningStateUpdating                DeploymentProvisioningState = "Updating"
)

type DeploymentService

type DeploymentService interface {
	GenerateDeploymentName(baseName string) string
	CalculateTemplateHash(
		ctx context.Context,
		subscriptionId string,
		template azure.RawArmTemplate) (string, error)
	ListSubscriptionDeploymentResources(
		ctx context.Context,
		subscriptionId string,
		deploymentName string,
	) ([]*armresources.ResourceReference, error)
	ListResourceGroupDeploymentResources(
		ctx context.Context,
		subscriptionId string,
		resourceGroupName string,
		deploymentName string,
	) ([]*armresources.ResourceReference, error)
	ListSubscriptionDeployments(
		ctx context.Context,
		subscriptionId string,
	) ([]*ResourceDeployment, error)
	GetSubscriptionDeployment(
		ctx context.Context,
		subscriptionId string,
		deploymentName string,
	) (*ResourceDeployment, error)
	ListResourceGroupDeployments(
		ctx context.Context,
		subscriptionId string,
		resourceGroupName string,
	) ([]*ResourceDeployment, error)
	GetResourceGroupDeployment(
		ctx context.Context,
		subscriptionId string,
		resourceGroupName string,
		deploymentName string,
	) (*ResourceDeployment, error)
	DeployToSubscription(
		ctx context.Context,
		subscriptionId string,
		location string,
		deploymentName string,
		armTemplate azure.RawArmTemplate,
		parameters azure.ArmParameters,
		tags map[string]*string,
		options map[string]any,
	) (*ResourceDeployment, error)
	DeployToResourceGroup(
		ctx context.Context,
		subscriptionId,
		resourceGroup,
		deploymentName string,
		armTemplate azure.RawArmTemplate,
		parameters azure.ArmParameters,
		tags map[string]*string,
		options map[string]any,
	) (*ResourceDeployment, error)
	ListSubscriptionDeploymentOperations(
		ctx context.Context,
		subscriptionId string,
		deploymentName string,
	) ([]*armresources.DeploymentOperation, error)
	ListResourceGroupDeploymentOperations(
		ctx context.Context,
		subscriptionId string,
		resourceGroupName string,
		deploymentName string,
	) ([]*armresources.DeploymentOperation, error)
	WhatIfDeployToSubscription(
		ctx context.Context,
		subscriptionId string,
		location string,
		deploymentName string,
		armTemplate azure.RawArmTemplate,
		parameters azure.ArmParameters,
	) (*armresources.WhatIfOperationResult, error)
	WhatIfDeployToResourceGroup(
		ctx context.Context,
		subscriptionId,
		resourceGroup,
		deploymentName string,
		armTemplate azure.RawArmTemplate,
		parameters azure.ArmParameters,
	) (*armresources.WhatIfOperationResult, error)
	DeleteSubscriptionDeployment(
		ctx context.Context,
		subscriptionId string,
		deploymentName string,
		options map[string]any,
		progress *async.Progress[DeleteDeploymentProgress],
	) error
	DeleteResourceGroupDeployment(
		ctx context.Context,
		subscriptionId,
		resourceGroupName string,
		deploymentName string,
		options map[string]any,
		progress *async.Progress[DeleteDeploymentProgress],
	) error
}

type DeploymentType

type DeploymentType string
const (
	DeploymentTypeStandard DeploymentType = "deployments.standard"
	DeploymentTypeStacks   DeploymentType = "deployments.stacks"
)

type DockerCredentials

type DockerCredentials struct {
	// Username is the name of the user. Note that this may be set to a value like
	// '00000000-0000-0000-0000-000000000000' when using access tokens.
	Username string
	// Password is the password for the user, or the access token when using access tokens.
	Password    string
	LoginServer string
}

Credentials for authenticating with a docker registry, can be both username/password or access token based.

type Filter

type Filter struct {
	Key   string
	Value string
}

type ListResourceGroupOptions

type ListResourceGroupOptions struct {
	// An optional tag filter
	TagFilter *Filter
	// An optional filter expression to filter the resource group results
	// https://learn.microsoft.com/en-us/rest/api/resources/resource-groups/list
	Filter *string
}

Optional parameters for resource group listing.

type ListResourceGroupResourcesOptions

type ListResourceGroupResourcesOptions struct {
	// An optional filter expression to filter the resource list result
	// https://learn.microsoft.com/en-us/rest/api/resources/resources/list-by-resource-group#uri-parameters
	Filter *string
}

Optional parameters for resource group resources listing.

type ManagedClustersService

type ManagedClustersService interface {
	// Gets the managed cluster resource by name
	Get(
		ctx context.Context,
		subscriptionId string,
		resourceGroupName string,
		resourceName string,
	) (*armcontainerservice.ManagedCluster, error)
	// Gets the user credentials for the specified resource
	GetUserCredentials(
		ctx context.Context,
		subscriptionId string,
		resourceGroupName string,
		resourceName string,
	) (*armcontainerservice.CredentialResults, error)
}

ManagedClustersService provides actions on top of Azure Kubernetes Service (AKS) Managed Clusters

func NewManagedClustersService

func NewManagedClustersService(
	credentialProvider account.SubscriptionCredentialProvider,
	armClientOptions *arm.ClientOptions,
) ManagedClustersService

Creates a new instance of the ManagedClustersService

type ReportDeleteProgress

type ReportDeleteProgress func(progress *DeleteDeploymentProgress)

type Resource

type Resource struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	Location string `json:"location"`
}

type ResourceDeployment

type ResourceDeployment struct {
	// The Azure resource id of the deployment operation
	Id string

	// The location of the deployment
	Location string

	// The Azure resource id of the actual deployment object
	DeploymentId string

	// The deployment name
	Name string

	// The deployment type
	Type string

	// The tags associated with the deployment
	Tags map[string]*string

	// The outputs from the deployment
	Outputs any

	// The hash produced for the template.
	TemplateHash *string

	// The timestamp of the template deployment.
	Timestamp time.Time

	// The resources created from the deployment
	Resources []*armresources.ResourceReference

	// The dependencies of the deployment
	Dependencies []*armresources.Dependency

	// The status of the deployment
	ProvisioningState DeploymentProvisioningState

	PortalUrl string

	OutputsUrl string

	DeploymentUrl string
}

type ResourceExtended

type ResourceExtended struct {
	Resource
	Kind string `json:"kind"`
}

type ResourceService

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

func NewResourceService

func NewResourceService(
	credentialProvider account.SubscriptionCredentialProvider,
	armClientOptions *arm.ClientOptions,
) *ResourceService

func (*ResourceService) CreateOrUpdateResourceGroup

func (rs *ResourceService) CreateOrUpdateResourceGroup(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	location string,
	tags map[string]*string,
) error

func (*ResourceService) DeleteResourceGroup

func (rs *ResourceService) DeleteResourceGroup(ctx context.Context, subscriptionId string, resourceGroupName string) error

func (*ResourceService) GetResource

func (rs *ResourceService) GetResource(
	ctx context.Context, subscriptionId string, resourceId string, apiVersion string) (ResourceExtended, error)

func (*ResourceService) ListResourceGroup

func (rs *ResourceService) ListResourceGroup(
	ctx context.Context,
	subscriptionId string,
	listOptions *ListResourceGroupOptions,
) ([]*Resource, error)

func (*ResourceService) ListResourceGroupResources

func (rs *ResourceService) ListResourceGroupResources(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	listOptions *ListResourceGroupResourcesOptions,
) ([]*Resource, error)

type SpringAppProperties

type SpringAppProperties struct {
	Url []string
}

type SpringService

type SpringService interface {
	// Get Spring app properties
	GetSpringAppProperties(
		ctx context.Context,
		subscriptionId string,
		resourceGroupName string,
		instanceName string,
		appName string,
	) (*SpringAppProperties, error)
	// Deploy jar artifact to ASA app deployment
	DeploySpringAppArtifact(
		ctx context.Context,
		subscriptionId string,
		resourceGroup string,
		instanceName string,
		appName string,
		relativePath string,
		deploymentName string,
	) (*string, error)
	// Upload jar artifact to ASA app Storage File
	UploadSpringArtifact(
		ctx context.Context,
		subscriptionId string,
		resourceGroup string,
		instanceName string,
		appName string,
		artifactPath string,
	) (*string, error)
	// Get Spring app deployment
	GetSpringAppDeployment(
		ctx context.Context,
		subscriptionId string,
		resourceGroupName string,
		instanceName string,
		appName string,
		deploymentName string,
	) (*string, error)
}

SpringService provides artifacts upload/deploy and query to Azure Spring Apps (ASA)

func NewSpringService

func NewSpringService(
	credentialProvider account.SubscriptionCredentialProvider,
	armClientOptions *arm.ClientOptions,
) SpringService

Creates a new instance of the NewSpringService

type StackDeployments

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

func NewStackDeployments

func NewStackDeployments(
	credentialProvider account.SubscriptionCredentialProvider,
	armClientOptions *arm.ClientOptions,
	standardDeployments *StandardDeployments,
	cloud *cloud.Cloud,
	clock clock.Clock,
) *StackDeployments

func (*StackDeployments) CalculateTemplateHash

func (d *StackDeployments) CalculateTemplateHash(
	ctx context.Context,
	subscriptionId string,
	template azure.RawArmTemplate,
) (string, error)

func (*StackDeployments) DeleteResourceGroupDeployment

func (d *StackDeployments) DeleteResourceGroupDeployment(
	ctx context.Context,
	subscriptionId,
	resourceGroupName string,
	deploymentName string,
	options map[string]any,
	progress *async.Progress[DeleteDeploymentProgress],
) error

func (*StackDeployments) DeleteSubscriptionDeployment

func (d *StackDeployments) DeleteSubscriptionDeployment(
	ctx context.Context,
	subscriptionId string,
	deploymentName string,
	options map[string]any,
	progress *async.Progress[DeleteDeploymentProgress],
) error

func (*StackDeployments) DeployToResourceGroup

func (d *StackDeployments) DeployToResourceGroup(
	ctx context.Context,
	subscriptionId string,
	resourceGroup string,
	deploymentName string,
	armTemplate azure.RawArmTemplate,
	parameters azure.ArmParameters,
	tags map[string]*string,
	options map[string]any,
) (*ResourceDeployment, error)

func (*StackDeployments) DeployToSubscription

func (d *StackDeployments) DeployToSubscription(
	ctx context.Context,
	subscriptionId string,
	location string,
	deploymentName string,
	armTemplate azure.RawArmTemplate,
	parameters azure.ArmParameters,
	tags map[string]*string,
	options map[string]any,
) (*ResourceDeployment, error)

func (*StackDeployments) GenerateDeploymentName

func (d *StackDeployments) GenerateDeploymentName(baseName string) string

GenerateDeploymentName creates a name to use for the deployment stack from the base name.

func (*StackDeployments) GetResourceGroupDeployment

func (d *StackDeployments) GetResourceGroupDeployment(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	deploymentName string,
) (*ResourceDeployment, error)

func (*StackDeployments) GetSubscriptionDeployment

func (d *StackDeployments) GetSubscriptionDeployment(
	ctx context.Context,
	subscriptionId string,
	deploymentName string,
) (*ResourceDeployment, error)

func (*StackDeployments) ListResourceGroupDeploymentOperations

func (d *StackDeployments) ListResourceGroupDeploymentOperations(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	deploymentName string,
) ([]*armresources.DeploymentOperation, error)

func (*StackDeployments) ListResourceGroupDeploymentResources

func (d *StackDeployments) ListResourceGroupDeploymentResources(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	deploymentName string,
) ([]*armresources.ResourceReference, error)

func (*StackDeployments) ListResourceGroupDeployments

func (d *StackDeployments) ListResourceGroupDeployments(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
) ([]*ResourceDeployment, error)

func (*StackDeployments) ListSubscriptionDeploymentOperations

func (d *StackDeployments) ListSubscriptionDeploymentOperations(
	ctx context.Context,
	subscriptionId string,
	deploymentName string,
) ([]*armresources.DeploymentOperation, error)

func (*StackDeployments) ListSubscriptionDeploymentResources

func (d *StackDeployments) ListSubscriptionDeploymentResources(
	ctx context.Context,
	subscriptionId string,
	deploymentName string,
) ([]*armresources.ResourceReference, error)

func (*StackDeployments) ListSubscriptionDeployments

func (d *StackDeployments) ListSubscriptionDeployments(
	ctx context.Context,
	subscriptionId string,
) ([]*ResourceDeployment, error)

func (*StackDeployments) WhatIfDeployToResourceGroup

func (d *StackDeployments) WhatIfDeployToResourceGroup(
	ctx context.Context,
	subscriptionId string,
	resourceGroup string,
	deploymentName string,
	armTemplate azure.RawArmTemplate,
	parameters azure.ArmParameters,
) (*armresources.WhatIfOperationResult, error)

func (*StackDeployments) WhatIfDeployToSubscription

func (d *StackDeployments) WhatIfDeployToSubscription(
	ctx context.Context,
	subscriptionId string,
	location string,
	deploymentName string,
	armTemplate azure.RawArmTemplate,
	parameters azure.ArmParameters,
) (*armresources.WhatIfOperationResult, error)

type StandardDeployments

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

func NewStandardDeployments

func NewStandardDeployments(
	credentialProvider account.SubscriptionCredentialProvider,
	armClientOptions *arm.ClientOptions,
	resourceService *ResourceService,
	cloud *cloud.Cloud,
	clock clock.Clock,
) *StandardDeployments

func (*StandardDeployments) CalculateTemplateHash

func (ds *StandardDeployments) CalculateTemplateHash(
	ctx context.Context,
	subscriptionId string,
	template azure.RawArmTemplate,
) (string, error)

func (*StandardDeployments) DeleteResourceGroupDeployment

func (ds *StandardDeployments) DeleteResourceGroupDeployment(
	ctx context.Context,
	subscriptionId,
	resourceGroupName string,
	deploymentName string,
	options map[string]any,
	progress *async.Progress[DeleteDeploymentProgress],
) error

func (*StandardDeployments) DeleteSubscriptionDeployment

func (ds *StandardDeployments) DeleteSubscriptionDeployment(
	ctx context.Context,
	subscriptionId string,
	deploymentName string,
	options map[string]any,
	progress *async.Progress[DeleteDeploymentProgress],
) error

func (*StandardDeployments) DeployToResourceGroup

func (ds *StandardDeployments) DeployToResourceGroup(
	ctx context.Context,
	subscriptionId, resourceGroup, deploymentName string,
	armTemplate azure.RawArmTemplate,
	parameters azure.ArmParameters,
	tags map[string]*string,
	options map[string]any,
) (*ResourceDeployment, error)

func (*StandardDeployments) DeployToSubscription

func (ds *StandardDeployments) DeployToSubscription(
	ctx context.Context,
	subscriptionId string,
	location string,
	deploymentName string,
	armTemplate azure.RawArmTemplate,
	parameters azure.ArmParameters,
	tags map[string]*string,
	options map[string]any,
) (*ResourceDeployment, error)

func (*StandardDeployments) GenerateDeploymentName

func (ds *StandardDeployments) GenerateDeploymentName(baseName string) string

GenerateDeploymentName creates a name to use for the deployment object for a given environment. It appends the current unix time to the environment name (separated by a hyphen) to provide a unique name for each deployment. If the resulting name is longer than the ARM limit, the longest suffix of the name under the limit is returned.

func (*StandardDeployments) GetResourceGroupDeployment

func (ds *StandardDeployments) GetResourceGroupDeployment(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	deploymentName string,
) (*ResourceDeployment, error)

func (*StandardDeployments) GetSubscriptionDeployment

func (ds *StandardDeployments) GetSubscriptionDeployment(
	ctx context.Context,
	subscriptionId string,
	deploymentName string,
) (*ResourceDeployment, error)

func (*StandardDeployments) ListResourceGroupDeploymentOperations

func (ds *StandardDeployments) ListResourceGroupDeploymentOperations(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	deploymentName string,
) ([]*armresources.DeploymentOperation, error)

func (*StandardDeployments) ListResourceGroupDeploymentResources

func (ds *StandardDeployments) ListResourceGroupDeploymentResources(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
	deploymentName string,
) ([]*armresources.ResourceReference, error)

func (*StandardDeployments) ListResourceGroupDeployments

func (ds *StandardDeployments) ListResourceGroupDeployments(
	ctx context.Context,
	subscriptionId string,
	resourceGroupName string,
) ([]*ResourceDeployment, error)

func (*StandardDeployments) ListSubscriptionDeploymentOperations

func (ds *StandardDeployments) ListSubscriptionDeploymentOperations(
	ctx context.Context,
	subscriptionId string,
	deploymentName string,
) ([]*armresources.DeploymentOperation, error)

func (*StandardDeployments) ListSubscriptionDeploymentResources

func (ds *StandardDeployments) ListSubscriptionDeploymentResources(
	ctx context.Context,
	subscriptionId string,
	deploymentName string,
) ([]*armresources.ResourceReference, error)

func (*StandardDeployments) ListSubscriptionDeployments

func (ds *StandardDeployments) ListSubscriptionDeployments(
	ctx context.Context,
	subscriptionId string,
) ([]*ResourceDeployment, error)

func (*StandardDeployments) WhatIfDeployToResourceGroup

func (ds *StandardDeployments) WhatIfDeployToResourceGroup(
	ctx context.Context,
	subscriptionId, resourceGroup, deploymentName string,
	armTemplate azure.RawArmTemplate,
	parameters azure.ArmParameters,
) (*armresources.WhatIfOperationResult, error)

func (*StandardDeployments) WhatIfDeployToSubscription

func (ds *StandardDeployments) WhatIfDeployToSubscription(
	ctx context.Context,
	subscriptionId string,
	location string,
	deploymentName string,
	armTemplate azure.RawArmTemplate,
	parameters azure.ArmParameters,
) (*armresources.WhatIfOperationResult, error)

type UserProfileService

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

UserProfileService allows querying for user profile information.

func NewUserProfileService

func NewUserProfileService(
	credentialProvider auth.MultiTenantCredentialProvider,
	coreClientOptions *azcore.ClientOptions,
	cloud *cloud.Cloud,
) *UserProfileService

func (*UserProfileService) GetAccessToken

func (u *UserProfileService) GetAccessToken(ctx context.Context, tenantId string) (*AzCliAccessToken, error)

func (*UserProfileService) GetSignedInUserId

func (user *UserProfileService) GetSignedInUserId(ctx context.Context, tenantId string) (string, error)

Jump to

Keyboard shortcuts

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