azure

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Service configuration for Azure SQL. Namespaced with dapr.io
	ServiceAzureSQL cloud.ServiceName = "dapr.io/azuresql"
	// Service configuration for OSS RDBMS (Azure Database for PostgreSQL and MySQL). Namespaced with dapr.io
	ServiceOSSRDBMS cloud.ServiceName = "dapr.io/oss-rdbms"
)
View Source
const DefaultAzureEnvironment = "AzurePublic"

Default Azure environment.

Variables

View Source
var (
	ServiceAzureStorage  azureService = "azurestorage"
	ServiceAzureKeyVault azureService = "azurekeyvault"
)
View Source
var MetadataKeys = map[string][]string{

	"Certificate": {"azureCertificate", "spnCertificate"},

	"CertificateFile": {"azureCertificateFile", "spnCertificateFile"},

	"CertificatePassword": {"azureCertificatePassword", "spnCertificatePassword"},

	"ClientID": {"azureClientId", "spnClientId", "clientId"},

	"ClientSecret": {"azureClientSecret", "spnClientSecret", "clientSecret"},

	"TenantID": {"azureTenantId", "spnTenantId", "tenantId"},

	"AzureEnvironment": {"azureEnvironment", "azureCloud"},

	"AzureAuthMethods": {"azureAuthMethods", "azureADAuthMethods", "entraIDAuthMethods", "microsoftEntraIDAuthMethods"},

	"StorageAccountName": {"accountName", "storageAccount", "storageAccountName"},

	"StorageAccountKey": {"accountKey", "accessKey", "storageAccessKey", "storageAccountKey"},

	"StorageContainerName": {"containerName", "container", "storageAccountContainer"},

	"StorageQueueName": {"queueName", "queue", "storageAccountQueue"},

	"StorageTableName": {"tableName", "table", "storageAccountTable"},

	"StorageEndpoint": {"endpoint", "storageEndpoint", "storageAccountEndpoint", "queueEndpointUrl"},
}

MetadataKeys contains keys for all metadata properties.

Functions

This section is empty.

Types

type CertConfig

type CertConfig struct {
	ClientID            string
	CertificatePath     string
	CertificatePassword string
	TenantID            string
	CertificateData     []byte
	AzureCloud          *cloud.Configuration
}

CertConfig provides the options to get a bearer authorizer from a client certificate.

func (CertConfig) GetTokenCredential

func (c CertConfig) GetTokenCredential() (token azcore.TokenCredential, err error)

GetTokenCredential returns the azcore.TokenCredential object from client certificate.

type CredentialsConfig

type CredentialsConfig struct {
	ClientID     string
	ClientSecret string
	TenantID     string
	AzureCloud   *cloud.Configuration
}

CredentialsConfig provides the options to get a bearer authorizer from client credentials.

func (CredentialsConfig) GetTokenCredential

func (c CredentialsConfig) GetTokenCredential() (token azcore.TokenCredential, err error)

GetTokenCredential returns the azcore.TokenCredential object from the credentials.

type EnvironmentSettings

type EnvironmentSettings struct {
	Metadata map[string]string
	Cloud    *cloud.Configuration
}

EnvironmentSettings hold settings to authenticate with Azure.

func NewEnvironmentSettings

func NewEnvironmentSettings(md map[string]string) (EnvironmentSettings, error)

NewEnvironmentSettings returns a new EnvironmentSettings configured for a given Azure resource.

func (EnvironmentSettings) EndpointSuffix

func (s EnvironmentSettings) EndpointSuffix(service azureService) string

EndpointSuffix returns the suffix for the endpoint depending on the cloud used.

func (EnvironmentSettings) GetAzureEnvironment

func (s EnvironmentSettings) GetAzureEnvironment() (*cloud.Configuration, error)

GetAzureEnvironment returns the Azure environment for a given name.

func (EnvironmentSettings) GetClientCert

func (s EnvironmentSettings) GetClientCert() (config CertConfig, err error)

GetClientCert creates a config object from the available certificate credentials. An error is returned if no certificate credentials are available.

func (EnvironmentSettings) GetClientCredentials

func (s EnvironmentSettings) GetClientCredentials() (config CredentialsConfig, err error)

GetClientCredentials creates a config object from the available client credentials. An error is returned if no certificate credentials are available.

func (EnvironmentSettings) GetEnvironment

func (s EnvironmentSettings) GetEnvironment(key string) (val string, ok bool)

GetAzureEnvironment returns the Azure environment for a given name, supporting aliases too.

func (EnvironmentSettings) GetMSI

func (s EnvironmentSettings) GetMSI() (config MSIConfig)

GetMSI creates a MSI config object from the available client ID.

func (EnvironmentSettings) GetTokenCredential

func (s EnvironmentSettings) GetTokenCredential() (azcore.TokenCredential, error)

GetTokenCredential returns an azcore.TokenCredential retrieved from the order specified via the azureAuthMethods component metadata property which denotes a comma-separated list of auth methods to try in order. The possible values contained are (case-insensitive): ServicePrincipal, Certificate, WorkloadIdentity, ManagedIdentity, CLI The string "None" can be used to disable Azure authentication.

If the azureAuthMethods property is not present, the following order is used (which with the exception of step 5 matches the DefaultAzureCredential order): 1. Client credentials 2. Client certificate 3. Workload identity 4. MSI (we use a timeout of 1 second when no compatible managed identity implementation is available) 5. Azure CLI

type MSIConfig

type MSIConfig struct {
	ClientID string
}

MSIConfig provides the options to get a bearer authorizer through MSI.

func (MSIConfig) GetTokenCredential

func (c MSIConfig) GetTokenCredential() (token azcore.TokenCredential, err error)

GetTokenCredential returns the azcore.TokenCredential object from MSI.

Jump to

Keyboard shortcuts

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