azure

package
v0.0.0-...-ebb33e4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

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"},

	"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, in order: 1. Client credentials 2. Client certificate 3. Workload identity 4. MSI with a timeout of 1 second 5. Azure CLI 6. Retry MSI without timeout

This order and timeout (with the exception of the additional step 5) matches the DefaultAzureCredential.

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