Documentation ¶
Index ¶
- Constants
- func AvailabilitySetExists(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) bool
- func AvailabilitySetExistsE(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) (bool, error)
- func CheckAvailabilitySetContainsVM(t testing.TestingT, vmName string, avsName string, resGroupName string, ...) bool
- func CheckAvailabilitySetContainsVME(t testing.TestingT, vmName string, avsName string, resGroupName string, ...) (bool, error)
- func GetActionGroupResource(t *testing.T, ruleName string, resGroupName string, subscriptionID string) *insights.ActionGroupResource
- func GetActionGroupResourceE(ruleName string, resGroupName string, subscriptionID string) (*insights.ActionGroupResource, error)
- func GetAllAzureRegions(t testing.TestingT, subscriptionID string) []string
- func GetAllAzureRegionsE(t testing.TestingT, subscriptionID string) ([]string, error)
- func GetAvailabilitySetClientE(subscriptionID string) (*compute.AvailabilitySetsClient, error)
- func GetAvailabilitySetE(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) (*compute.AvailabilitySet, error)
- func GetAvailabilitySetFaultDomainCount(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) int32
- func GetAvailabilitySetFaultDomainCountE(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) (int32, error)
- func GetAvailabilitySetVMNamesInCaps(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) []string
- func GetAvailabilitySetVMNamesInCapsE(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) ([]string, error)
- func GetCustomNsgRulesClient(t *testing.T, subscriptionID string) network.SecurityRulesClient
- func GetCustomNsgRulesClientE(subscriptionID string) (network.SecurityRulesClient, error)
- func GetDefaultNsgRulesClient(t *testing.T, subscriptionID string) network.DefaultSecurityRulesClient
- func GetDefaultNsgRulesClientE(subscriptionID string) (network.DefaultSecurityRulesClient, error)
- func GetManagedClusterE(t testing.TestingT, resourceGroupName, clusterName, subscriptionID string) (*containerservice.ManagedCluster, error)
- func GetManagedClustersClientE(subscriptionID string) (*containerservice.ManagedClustersClient, error)
- func GetNameFromResourceID(resourceID string) string
- func GetRandomRegion(t testing.TestingT, approvedRegions []string, forbiddenRegions []string, ...) string
- func GetRandomRegionE(t testing.TestingT, approvedRegions []string, forbiddenRegions []string, ...) (string, error)
- func GetRandomStableRegion(t testing.TestingT, approvedRegions []string, forbiddenRegions []string, ...) string
- func GetSizeOfVirtualMachine(t testing.TestingT, vmName string, resGroupName string, subscriptionID string) compute.VirtualMachineSizeTypes
- func GetSizeOfVirtualMachineE(t testing.TestingT, vmName string, resGroupName string, subscriptionID string) (compute.VirtualMachineSizeTypes, error)
- func GetSubscriptionClient() (*subscriptions.Client, error)
- func GetTagsForVirtualMachine(t testing.TestingT, vmName string, resGroupName string, subscriptionID string) map[string]string
- func GetTagsForVirtualMachineE(t testing.TestingT, vmName string, resGroupName string, subscriptionID string) (map[string]string, error)
- func GetTargetAzureResourceGroupName(resourceGroupName string) (string, error)
- func GetTargetAzureSubscription(subscriptionID string) (string, error)
- func GetVirtualMachineClientE(subscriptionID string) (*compute.VirtualMachinesClient, error)
- func NewAuthorizer() (*autorest.Authorizer, error)
- type NotFoundError
- type NsgRuleSummary
- type NsgRuleSummaryList
- type ResourceGroupNameNotFound
- type SubscriptionIDNotFound
Constants ¶
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" )
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 AvailabilitySetExists ¶ added in v0.30.3
func AvailabilitySetExists(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) bool
AvailabilitySetExists indicates whether the specified Azure Availability Set exists. This function would fail the test if there is an error.
func AvailabilitySetExistsE ¶ added in v0.30.3
func AvailabilitySetExistsE(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) (bool, error)
AvailabilitySetExistsE indicates whether the specified Azure Availability Set exists
func CheckAvailabilitySetContainsVM ¶ added in v0.30.3
func CheckAvailabilitySetContainsVM(t testing.TestingT, vmName string, avsName string, resGroupName string, subscriptionID string) bool
CheckAvailabilitySetContainsVM checks if the Virtual Machine is contained in the Availability Set VMs. This function would fail the test if there is an error.
func CheckAvailabilitySetContainsVME ¶ added in v0.30.3
func CheckAvailabilitySetContainsVME(t testing.TestingT, vmName string, avsName string, resGroupName string, subscriptionID string) (bool, error)
CheckAvailabilitySetContainsVME checks if the Virtual Machine is contained in the Availability Set VMs
func GetActionGroupResource ¶ added in v0.30.2
func GetActionGroupResource(t *testing.T, ruleName string, resGroupName string, subscriptionID string) *insights.ActionGroupResource
GetActionGroupResource gets the ActionGroupResource. ruleName - required to find the ActionGroupResource. resGroupName - use an empty string if you have the AZURE_RES_GROUP_NAME environment variable set subscriptionId - use an empty string if you have the ARM_SUBSCRIPTION_ID environment variable set
func GetActionGroupResourceE ¶ added in v0.30.2
func GetActionGroupResourceE(ruleName string, resGroupName string, subscriptionID string) (*insights.ActionGroupResource, error)
GetActionGroupResourceE gets the ActionGroupResource with Error details on error. ruleName - required to find the ActionGroupResource. resGroupName - use an empty string if you have the AZURE_RES_GROUP_NAME environment variable set subscriptionId - use an empty string if you have the ARM_SUBSCRIPTION_ID environment variable set
func GetAllAzureRegions ¶
GetAllAzureRegions gets the list of Azure regions available in this subscription.
func GetAllAzureRegionsE ¶
GetAllAzureRegionsE gets the list of Azure regions available in this subscription
func GetAvailabilitySetClientE ¶ added in v0.30.3
func GetAvailabilitySetClientE(subscriptionID string) (*compute.AvailabilitySetsClient, error)
GetAvailabilitySetClientE gets a new Availability Set client in the specified Azure Subscription
func GetAvailabilitySetE ¶ added in v0.30.3
func GetAvailabilitySetE(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) (*compute.AvailabilitySet, error)
GetAvailabilitySetE gets an Availability Set in the specified Azure Resource Group
func GetAvailabilitySetFaultDomainCount ¶ added in v0.30.3
func GetAvailabilitySetFaultDomainCount(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) int32
GetAvailabilitySetFaultDomainCount gets the Fault Domain Count for the specified Azure Availability Set. This function would fail the test if there is an error.
func GetAvailabilitySetFaultDomainCountE ¶ added in v0.30.3
func GetAvailabilitySetFaultDomainCountE(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) (int32, error)
GetAvailabilitySetFaultDomainCountE gets the Fault Domain Count for the specified Azure Availability Set
func GetAvailabilitySetVMNamesInCaps ¶ added in v0.30.3
func GetAvailabilitySetVMNamesInCaps(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) []string
GetAvailabilitySetVMNamesInCaps gets a list of VM names in the specified Azure Availability Set. This function would fail the test if there is an error.
func GetAvailabilitySetVMNamesInCapsE ¶ added in v0.30.3
func GetAvailabilitySetVMNamesInCapsE(t testing.TestingT, avsName string, resGroupName string, subscriptionID string) ([]string, error)
GetAvailabilitySetVMNamesInCapsE gets a list of VM names in the specified Azure Availability Set
func GetCustomNsgRulesClient ¶ added in v0.30.4
func GetCustomNsgRulesClient(t *testing.T, subscriptionID string) network.SecurityRulesClient
GetCustomNsgRulesClient returns a rules client which can be used to read the list of *custom* security rules defined on an network security group. Note that the "custom" rules are those defined by end users. This function would fail the test if there is an error.
func GetCustomNsgRulesClientE ¶ added in v0.30.4
func GetCustomNsgRulesClientE(subscriptionID string) (network.SecurityRulesClient, error)
GetCustomNsgRulesClientE returns a rules client which can be used to read the list of *custom* security rules defined on an network security group. Note that the "custom" rules are those defined by end users.
func GetDefaultNsgRulesClient ¶ added in v0.30.4
func GetDefaultNsgRulesClient(t *testing.T, subscriptionID string) network.DefaultSecurityRulesClient
GetDefaultNsgRulesClient returns a rules client which can be used to read the list of *default* security rules defined on an network security group. Note that the "default" rules are those provided implicitly by the Azure platform. This function would fail the test if there is an error.
func GetDefaultNsgRulesClientE ¶ added in v0.30.4
func GetDefaultNsgRulesClientE(subscriptionID string) (network.DefaultSecurityRulesClient, error)
GetDefaultNsgRulesClientE returns a rules client which can be used to read the list of *default* security rules defined on an network security group. Note that the "default" rules are those provided implicitly by the Azure platform.
func GetManagedClusterE ¶ added in v0.24.2
func GetManagedClusterE(t testing.TestingT, resourceGroupName, clusterName, subscriptionID string) (*containerservice.ManagedCluster, error)
GetManagedClusterE will return ManagedCluster
func GetManagedClustersClientE ¶ added in v0.24.2
func GetManagedClustersClientE(subscriptionID string) (*containerservice.ManagedClustersClient, error)
GetManagedClustersClientE is a helper function that will setup an Azure ManagedClusters client on your behalf
func GetNameFromResourceID ¶ added in v0.30.3
GetNameFromResourceID gets the Name from an Azure Resource ID
func GetRandomRegion ¶
func GetRandomRegion(t testing.TestingT, 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.TestingT, 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.TestingT, approvedRegions []string, forbiddenRegions []string, subscriptionID string) string
GetRandomStableRegion 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.TestingT, vmName string, resGroupName string, subscriptionID string) compute.VirtualMachineSizeTypes
GetSizeOfVirtualMachine gets the size type of the given Azure Virtual Machine. This function would fail the test if there is an error.
func GetSizeOfVirtualMachineE ¶
func GetSizeOfVirtualMachineE(t testing.TestingT, 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.TestingT, vmName string, resGroupName string, subscriptionID string) map[string]string
GetTagsForVirtualMachine gets the tags of the given Virtual Machine as a map. This function would fail the test if there is an error.
func GetTagsForVirtualMachineE ¶
func GetTagsForVirtualMachineE(t testing.TestingT, vmName string, resGroupName string, subscriptionID string) (map[string]string, error)
GetTagsForVirtualMachineE gets the tags of the given Virtual Machine as a map
func GetTargetAzureResourceGroupName ¶ added in v0.29.1
GetTargetAzureResourceGroupName is a helper function to find the correct target Azure Resource Group name, with provided arguments taking precedence over environment variables
func GetTargetAzureSubscription ¶ added in v0.29.1
GetTargetAzureSubscription is a helper function to find the correct target Azure Subscription ID, with provided arguments taking precedence over environment variables
func GetVirtualMachineClientE ¶ added in v0.30.3
func GetVirtualMachineClientE(subscriptionID string) (*compute.VirtualMachinesClient, error)
GetVirtualMachineClientE 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 NotFoundError ¶ added in v0.30.3
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError is returned when an expected object is not found in the search spa
func NewNotFoundError ¶ added in v0.30.3
func NewNotFoundError(objectType string, objectID string, region string) NotFoundError
NewNotFoundError creates a new not found error when an expected object is not found in the search space
func (NotFoundError) Error ¶ added in v0.30.3
func (err NotFoundError) Error() string
type NsgRuleSummary ¶ added in v0.30.4
type NsgRuleSummary struct { Name string Description string Protocol string SourcePortRange string DestinationPortRange string SourceAddressPrefix string DestinationAddressPrefix string Access string Priority int32 Direction string }
NsgRuleSummary is a string-based (non-pointer) summary of an NSG rule with several helper methods attached to help with verification of rule configuratoin.
func (*NsgRuleSummary) AllowsDestinationPort ¶ added in v0.30.4
func (summarizedRule *NsgRuleSummary) AllowsDestinationPort(t *testing.T, port string) bool
AllowsDestinationPort checks to see if the rule allows a specific destination port. This is helpful when verifying that a given rule is configured properly for a given port.
func (*NsgRuleSummary) AllowsSourcePort ¶ added in v0.30.4
func (summarizedRule *NsgRuleSummary) AllowsSourcePort(t *testing.T, port string) bool
AllowsSourcePort checks to see if the rule allows a specific source port. This is helpful when verifying that a given rule is configured properly for a given port.
type NsgRuleSummaryList ¶ added in v0.30.4
type NsgRuleSummaryList struct {
SummarizedRules []NsgRuleSummary
}
NsgRuleSummaryList holds a colleciton of NsgRuleSummary rules
func GetAllNSGRules ¶ added in v0.30.4
func GetAllNSGRules(t *testing.T, resourceGroupName, nsgName, subscriptionID string) NsgRuleSummaryList
GetAllNSGRules returns an NsgRuleSummaryList instance containing the combined "default" and "custom" rules from a network security group. This function would fail the test if there is an error.
func GetAllNSGRulesE ¶ added in v0.30.4
func GetAllNSGRulesE(resourceGroupName, nsgName, subscriptionID string) (NsgRuleSummaryList, error)
GetAllNSGRulesE returns an NsgRuleSummaryList instance containing the combined "default" and "custom" rules from a network security group.
func (*NsgRuleSummaryList) FindRuleByName ¶ added in v0.30.4
func (summarizedRules *NsgRuleSummaryList) FindRuleByName(name string) NsgRuleSummary
FindRuleByName looks for a matching rule by name within the current collection of rules.
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