Documentation ¶
Overview ¶
Package az provides utility types and functions for Azure SDK.
Index ¶
Constants ¶
const NilGUID = "00000000-0000-0000-0000-000000000000"
NilGUID is an all-zero GUID.
Variables ¶
This section is empty.
Functions ¶
func EnvForActiveDirectory ¶
func EnvForActiveDirectory(adEndpoint string) *azure.Environment
EnvForActiveDirectory returns the environment for the specified Azure AD endpoint.
func EnvForLocation ¶
func EnvForLocation(loc string) *azure.Environment
EnvForLocation returns the environment for the specified location.
Types ¶
type Cfg ¶
type Cfg struct { Src string // Source of config information azure.Environment // Endpoints for the current cloud TenantID string // Active Directory tenant GUID SubscriptionID string // Default subscription GUID Location string // Default location name // contains filtered or unexported fields }
Cfg contains the information necessary to create Azure API clients.
func LoadCfg ¶
LoadCfg loads client configuration, automatically selecting environment variables, SDK auth file, MSI, or CLI config as the source.
func LoadCfgFromCLI ¶
LoadCfgFromCLI loads client configuration from Azure CLI.
func LoadCfgFromEnv ¶
LoadCfgFromEnv loads client configuration from environment variables. If e is nil, the environment is loaded automatically.
func LoadCfgFromFile ¶
LoadCfgFromFile loads client configuration from an SDK auth file created by 'az ad sp create-for-rbac --sdk-auth' command. The file name defaults to AZURE_AUTH_LOCATION environment variable if empty.
func LoadCfgFromMSI ¶
LoadCfgFromMSI loads client configuration from the Managed Service Identity endpoint.
func (*Cfg) Authorizer ¶
func (c *Cfg) Authorizer(resource string) autorest.Authorizer
Authorizer returns an authorizer for the specified resource.
type ComputeMetadata ¶
type ComputeMetadata struct { Location string Name string Offer string OSType string PlacementGroupID string PlatformFaultDomain string PlatformUpdateDomain string Publisher string ResourceGroupName string SKU string SubscriptionID string Tags string Version string VMID string VMScaleSetName string VMSize string Zone string }
ComputeMetadata contains basic VM information.
type Env ¶
type Env struct { AuthFile string `env:"AZURE_AUTH_LOCATION"` CertPass string `env:"AZURE_CERTIFICATE_PASSWORD"` CertFile string `env:"AZURE_CERTIFICATE_PATH"` ClientID string `env:"AZURE_CLIENT_ID"` ClientSecret string `env:"AZURE_CLIENT_SECRET"` EnvName string `env:"AZURE_ENVIRONMENT"` Location string `env:"AZURE_LOCATION"` SubscriptionID string `env:"AZURE_SUBSCRIPTION"` TenantID string `env:"AZURE_TENANT_ID"` }
Env defines environment variables used by the SDK (not to be confused with azure.Environment, which defines Azure endpoints).
type InstanceMetadata ¶
type InstanceMetadata struct {
Compute ComputeMetadata
}
InstanceMetadata contains VM metadata obtained from the Instance Metadata Service (IMDS).
func GetInstanceMetadata ¶
func GetInstanceMetadata() (im InstanceMetadata, err error)
GetInstanceMetadata returns VM metadata from IMDS.
type Paginator ¶
type Paginator struct { Err error // contains filtered or unexported fields }
Paginator simplifies API call pagination. Example usage:
rp, err := client.ApiCall() pg := az.Paginate(&rp, err) for pg.Next() { // Use rp.Response() or rp.Values() } if pg.Err != nil { // Handler error }
type RID ¶
type RID string
RID is an Azure resource ID. A valid ID must begin with a '/' and contain an even number of path elements, which are interpreted as key/value pairs.
func (RID) ResourceGroup ¶
ResourceGroup returns the resource group name.
func (RID) Subscription ¶
Subscription returns the resource subscription ID.