azure

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: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TagKeyAzdEnvName is the name of the key in the tags map of a resource
	// used to store the azd environment a resource is associated with.
	TagKeyAzdEnvName = "azd-env-name"
	/* #nosec G101 - Potential hardcoded credentials - false positive */
	// TagKeyAzdDeploymentStateParamHashName is the name of the key in the tags map of a deployment
	// used to store the parameters hash.
	TagKeyAzdDeploymentStateParamHashName = "azd-provision-param-hash"
	// TagKeyAzdServiceName is the name of the key in the tags map of a resource
	// used to store the azd service a resource is associated with.
	TagKeyAzdServiceName = "azd-service-name"
)

Variables

This section is empty.

Functions

func ContainerAppRID

func ContainerAppRID(subscriptionId, resourceGroupName, containerAppName string) string

func GetResourceGroupName

func GetResourceGroupName(resourceId string) *string

Find the resource group name from the resource id

func KubernetesServiceRID

func KubernetesServiceRID(subscriptionId, resourceGroupName, clusterName string) string

func ResourceGroupDeploymentRID

func ResourceGroupDeploymentRID(subscriptionId string, resourceGroupName string, deploymentId string) string

Creates resource group level deployment resource ID

func ResourceGroupRID

func ResourceGroupRID(subscriptionId, resourceGroupName string) string

Creates resource ID for an Azure resource group

func SpringAppRID

func SpringAppRID(subscriptionId, resourceGroupName, springAppName string) string

func StaticWebAppRID

func StaticWebAppRID(subscriptionId, resourceGroupName, staticSiteName string) string

func SubscriptionDeploymentRID

func SubscriptionDeploymentRID(subscriptionId, deploymentId string) string

Creates subscription-level deployment resource ID

func SubscriptionFromRID

func SubscriptionFromRID(rid string) string

SubscriptionFromRID returns the subscription id component of a resource or panics if the resource id does not contain a subscription.

func SubscriptionRID

func SubscriptionRID(subscriptionId string) string

Creates Azure subscription resource ID

func WebsiteRID

func WebsiteRID(subscriptionId, resourceGroupName, websiteName string) string

Types

type ArmParameterFile

type ArmParameterFile struct {
	Schema         string        `json:"$schema"`
	ContentVersion string        `json:"contentVersion"`
	Parameters     ArmParameters `json:"parameters"`
}

ArmParametersFile is the model type for a `.parameters.json` file. It fits the schema outlined here: https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json

type ArmParameterValue

type ArmParameterValue struct {
	Value any `json:"value"`
}

ArmParameterValue wraps the configured value for the parameter.

type ArmParameters

type ArmParameters map[string]ArmParameterValue

ArmParameters is a map of arm template parameters to their configured values.

type ArmTemplate

type ArmTemplate struct {
	Schema         string                          `json:"$schema"`
	ContentVersion string                          `json:"contentVersion"`
	Parameters     ArmTemplateParameterDefinitions `json:"parameters"`
	Outputs        ArmTemplateOutputs              `json:"outputs"`
	Definitions    ArmTemplateParameterDefinitions `json:"definitions"`
}

ArmTemplate represents an Azure Resource Manager deployment template. It follows the structure outlined at https://learn.microsoft.com/azure/azure-resource-manager/templates/syntax, but only exposes portions of the object that azd cares about.

func (ArmTemplate) TargetScope

func (t ArmTemplate) TargetScope() (DeploymentScope, error)

TargetScope uses the $schema property of the template to determine what scope this template should be deployed at or an error if the scope could not be determined.

type ArmTemplateOutput

type ArmTemplateOutput struct {
	Type     string         `json:"type"`
	Value    any            `json:"value"`
	Metadata map[string]any `json:"metadata"`
	Ref      string         `json:"$ref"`
}

type ArmTemplateOutputs

type ArmTemplateOutputs map[string]ArmTemplateOutput

type ArmTemplateParameterAdditionalProperties

type ArmTemplateParameterAdditionalProperties struct {
	Type      string                     `json:"type"`
	MinValue  *int                       `json:"minValue,omitempty"`
	MaxValue  *int                       `json:"maxValue,omitempty"`
	MinLength *int                       `json:"minLength,omitempty"`
	MaxLength *int                       `json:"maxLength,omitempty"`
	Metadata  map[string]json.RawMessage `json:"metadata"`
}

type ArmTemplateParameterDefinition

type ArmTemplateParameterDefinition struct {
	Type                 string                                   `json:"type"`
	DefaultValue         any                                      `json:"defaultValue"`
	AllowedValues        *[]any                                   `json:"allowedValues,omitempty"`
	MinValue             *int                                     `json:"minValue,omitempty"`
	MaxValue             *int                                     `json:"maxValue,omitempty"`
	MinLength            *int                                     `json:"minLength,omitempty"`
	MaxLength            *int                                     `json:"maxLength,omitempty"`
	Metadata             map[string]json.RawMessage               `json:"metadata"`
	Ref                  string                                   `json:"$ref"`
	Properties           ArmTemplateParameterDefinitions          `json:"properties,omitempty"`
	AdditionalProperties ArmTemplateParameterAdditionalProperties `json:"additionalProperties,omitempty"`
}

func (ArmTemplateParameterDefinition) AzdMetadata

func (p ArmTemplateParameterDefinition) AzdMetadata() (AzdMetadata, bool)

AzdMetadata returns the value of the "azd" object metadata for this parameter or the zero value if it can not be found.

func (ArmTemplateParameterDefinition) Description

func (p ArmTemplateParameterDefinition) Description() (string, bool)

Description returns the value of the "Description" string metadata for this parameter or empty if it can not be found.

func (*ArmTemplateParameterDefinition) Secure

type ArmTemplateParameterDefinitions

type ArmTemplateParameterDefinitions map[string]ArmTemplateParameterDefinition

type AutoGenInput

type AutoGenInput struct {
	Length     uint  `json:"length,omitempty"`
	NoLower    *bool `json:"noLower,omitempty"`
	NoUpper    *bool `json:"noUpper,omitempty"`
	NoNumeric  *bool `json:"noNumeric,omitempty"`
	NoSpecial  *bool `json:"noSpecial,omitempty"`
	MinLower   *uint `json:"minLower,omitempty"`
	MinUpper   *uint `json:"minUpper,omitempty"`
	MinNumeric *uint `json:"minNumeric,omitempty"`
	MinSpecial *uint `json:"minSpecial,omitempty"`
}

type AzdMetadata

type AzdMetadata struct {
	Type               *AzdMetadataType `json:"type,omitempty"`
	AutoGenerateConfig *AutoGenInput    `json:"config,omitempty"`
}

type AzdMetadataType

type AzdMetadataType string
const AzdMetadataTypeGenerate AzdMetadataType = "generate"
const AzdMetadataTypeGenerateOrManual AzdMetadataType = "generateOrManual"
const AzdMetadataTypeLocation AzdMetadataType = "location"

type DeploymentScope

type DeploymentScope string
const DeploymentScopeResourceGroup DeploymentScope = "resourceGroup"
const DeploymentScopeSubscription DeploymentScope = "subscription"

type RawArmTemplate

type RawArmTemplate = json.RawMessage

RawArmTemplate is a JSON encoded ARM template.

Jump to

Keyboard shortcuts

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