azure

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AuthFromEnvClient is an env variable supported by the Azure SDK
	AuthFromEnvClient = "AZURE_CLIENT_ID"

	// AuthFromEnvTenant is an env variable supported by the Azure SDK
	AuthFromEnvTenant = "AZURE_TENANT_ID"

	// AuthFromFile is an env variable supported by the Azure SDK
	AuthFromFile = "AZURE_AUTH_LOCATION"
)
View Source
const (
	// AzureSubscriptionID is an optional env variable supported by the `azurerm` Terraform provider to
	// designate a target Azure subscription ID
	AzureSubscriptionID = "ARM_SUBSCRIPTION_ID"

	// AzureResGroupName is an optional env variable custom to Terratest to designate a target Azure resource group
	AzureResGroupName = "AZURE_RES_GROUP_NAME"
)

Variables

This section is empty.

Functions

func GetAllAzureRegions

func GetAllAzureRegions(t *testing.T, subscriptionID string) []string

GetAllAzureRegions gets the list of Azure regions available in this subscription.

func GetAllAzureRegionsE

func GetAllAzureRegionsE(t *testing.T, subscriptionID string) ([]string, error)

GetAllAzureRegionsE gets the list of Azure regions available in this subscription.

func GetRandomRegion

func GetRandomRegion(t *testing.T, approvedRegions []string, forbiddenRegions []string, subscriptionID string) string

GetRandomRegion gets a randomly chosen Azure region. If approvedRegions is not empty, this will be a region from the approvedRegions list; otherwise, this method will fetch the latest list of regions from the Azure APIs and pick one of those. If forbiddenRegions is not empty, this method will make sure the returned region is not in the forbiddenRegions list.

func GetRandomRegionE

func GetRandomRegionE(t *testing.T, approvedRegions []string, forbiddenRegions []string, subscriptionID string) (string, error)

GetRandomRegionE gets a randomly chosen Azure region. If approvedRegions is not empty, this will be a region from the approvedRegions list; otherwise, this method will fetch the latest list of regions from the Azure APIs and pick one of those. If forbiddenRegions is not empty, this method will make sure the returned region is not in the forbiddenRegions list.

func GetRandomStableRegion

func GetRandomStableRegion(t *testing.T, approvedRegions []string, forbiddenRegions []string, subscriptionID string) string

GetStableRandomRegion gets a randomly chosen Azure region that is considered stable. Like GetRandomRegion, you can further restrict the stable region list using approvedRegions and forbiddenRegions. We consider stable regions to be those that have been around for at least 1 year. Note that regions in the approvedRegions list that are not considered stable are ignored.

func GetSizeOfVirtualMachine

func GetSizeOfVirtualMachine(t *testing.T, vmName string, resGroupName string, subscriptionID string) compute.VirtualMachineSizeTypes

GetSizeOfVirtualMachine gets the size type of the given Azure Virtual Machine

func GetSizeOfVirtualMachineE

func GetSizeOfVirtualMachineE(t *testing.T, vmName string, resGroupName string, subscriptionID string) (compute.VirtualMachineSizeTypes, error)

GetSizeOfVirtualMachineE gets the size type of the given Azure Virtual Machine

func GetSubscriptionClient

func GetSubscriptionClient() (*subscriptions.Client, error)

GetSubscriptionClient is a helper function that will setup an Azure Subscription client on your behalf

func GetTagsForVirtualMachine

func GetTagsForVirtualMachine(t *testing.T, vmName string, resGroupName string, subscriptionID string) map[string]string

GetTagsForVirtualMachine gets the tags of the given Virtual Machine as a map

func GetTagsForVirtualMachineE

func GetTagsForVirtualMachineE(t *testing.T, vmName string, resGroupName string, subscriptionID string) (map[string]string, error)

GetTagsForVirtualMachineE gets the tags of the given Virtual Machine as a map

func GetVirtualMachineClient

func GetVirtualMachineClient(subscriptionID string) (*compute.VirtualMachinesClient, error)

GetVirtualMachineClient is a helper function that will setup an Azure Virtual Machine client on your behalf

func NewAuthorizer

func NewAuthorizer() (*autorest.Authorizer, error)

NewAuthorizer creates an Azure authorizer adhering to standard auth mechanisms provided by the Azure Go SDK See Azure Go Auth docs here: https://docs.microsoft.com/en-us/go/azure/azure-sdk-go-authorization

Types

type ResourceGroupNameNotFound

type ResourceGroupNameNotFound struct{}

ResourceGroupNameNotFound is an error that occurs when the target Azure Resource Group name could not be found or was not provided

func (ResourceGroupNameNotFound) Error

func (err ResourceGroupNameNotFound) Error() string

type SubscriptionIDNotFound

type SubscriptionIDNotFound struct{}

SubscriptionIDNotFound is an error that occurs when the Azure Subscription ID could not be found or was not provided

func (SubscriptionIDNotFound) Error

func (err SubscriptionIDNotFound) Error() string

Jump to

Keyboard shortcuts

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