azure

package
v0.0.0-...-7501429 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlertsCheck

func AlertsCheck(prefix, subscriptionID, resourceGroup string) error

AlertsCheck checks all resource groups have been created

func CheckVirtualMachineScaleSetVMsWithClient

func CheckVirtualMachineScaleSetVMsWithClient(
	ctx context.Context,
	vmScaleSetClient *compute.VirtualMachineScaleSetsClient,
	vmScaleSetClientVMs *compute.VirtualMachineScaleSetVMsClient,
	resourceGroup string,
	vmssNames ...string,
) ([]string, error)

func ClearTFBucket

func ClearTFBucket(storageAccount, storageAccessKey, containerName string) error

ClearTFBucket deletes all blobs from azure blob storage

func DeleteTFBucket

func DeleteTFBucket(storageAccount, storageAccessKey, containerName string) error

DeleteTFBucket deletes azure blob storage

func DeleteVMs

func DeleteVMs(
	ctx context.Context,
	client *compute.VirtualMachineScaleSetsClient,
	resourceGroup,
	vmScaleSetName string,
	vmScaleSetVMIDsToDelete []string,
	updateVMssCapacity bool,
) error

func EnsureTFBucket

func EnsureTFBucket(storageAccount, storageAccessKey, containerName string, forceDelete bool) (bool, error)

EnsureTFBucket creates azure blob storage

func FilterVirtualMachineScaleSets

func FilterVirtualMachineScaleSets(vms *[]compute.VirtualMachineScaleSet, handler func(vm compute.VirtualMachineScaleSet) bool)

func GetLoadBalancerIPs

func GetLoadBalancerIPs(lbs []network.LoadBalancer) map[string][]string

GetLoadBalancerIPs return map LB ID to slice of public IPs

func GetLoadBalancers

func GetLoadBalancers(prefix, subscriptionID, resourceGroup string) ([]network.LoadBalancer, error)

GetLoadBalancers returns load balancers for resource group

func GetMetricsClient

func GetMetricsClient(subscriptionID string) (insights.MetricsClient, error)

func GetMetricsDefinitionsClient

func GetMetricsDefinitionsClient(subscriptionID string) (insights.MetricDefinitionsClient, error)

func GetVMScaleSetClient

func GetVMScaleSetClient(subscriptionID string) (compute.VirtualMachineScaleSetsClient, error)

func GetVMScaleSetInstancesCount

func GetVMScaleSetInstancesCount(ctx context.Context, client *compute.VirtualMachineScaleSetsClient, resourceGroup, prefix string, locations ...string) (map[string]int, error)

func GetVMScaleSetNames

func GetVMScaleSetNames(ctx context.Context, client *compute.VirtualMachineScaleSetsClient, resourceGroup, prefix string) ([]string, error)

func GetVMScaleSetNamesWithInstances

func GetVMScaleSetNamesWithInstances(ctx context.Context, client *compute.VirtualMachineScaleSetsClient, resourceGroup, prefix string) ([]string, error)

func GetValidatorMetricNameForMetricNamespace

func GetValidatorMetricNameForMetricNamespace(
	ctx context.Context,
	client *insights.MetricDefinitionsClient,
	vmScaleSetName,
	resourceGroup,
	metricName,
	metricNameSpace string,
) (string, error)

GetValidatorMetricNameForMetricNamespace...

func GetValidatorMetricsForVMScaleSet

func GetValidatorMetricsForVMScaleSet(
	ctx context.Context,
	client *insights.MetricsClient,
	resourceGroup,
	vmScaleSetName,
	metricsName,
	metricNameSpace string,
	aggregationType insights.AggregationType,
) (insights.Metric, error)

GetValidatorMetricsForVMScaleSet ...

func GetValidatorMetricsForVMScaleSets

func GetValidatorMetricsForVMScaleSets(
	ctx context.Context,
	client *insights.MetricsClient,
	vmScaleSetNames []string,
	resourceGroup,
	metricsName,
	metricNameSpace string,
	aggregationType insights.AggregationType,
) (map[string]insights.Metric, error)

GetValidatorMetricsForVMScaleSets ...

func GetVirtualMachineScaleSets

func GetVirtualMachineScaleSets(prefix, subscriptionID, resourceGroup string) ([]compute.VirtualMachineScaleSet, error)

GetVirtualMachineScaleSets gets all test virtual machines

func GetVirtualMachineScaleSetsWithClient

func GetVirtualMachineScaleSetsWithClient(
	ctx context.Context,
	client *compute.VirtualMachineScaleSetsClient,
	prefix, resourceGroup string,
	locations ...string,
) ([]compute.VirtualMachineScaleSet, error)

GetVirtualMachineScaleSetsWithClient gets all test virtual machines

func HealthStatusCheck

func HealthStatusCheck(subscriptionID, resourceGroup string, vms VMSMap) error

HealthStatusCheck checks virtual machine scale set health status

func LogMetrics

func LogMetrics(metrics map[string]insights.Metric, level string)

LogMetrics ...

func Normalize

func Normalize(input string) string

Normalize transforms the human readable Azure Region/Location names (e.g. `West US`) into the canonical value to allow comparisons between user-code and API Responses

func NormalizeSlice

func NormalizeSlice(input []string) []string

func SMCheck

func SMCheck(prefix, subscriptionID, resourceGroup string) error

SMCheck checks key vault keys

func SchemaResourceGroupName

func SchemaResourceGroupName() *schema.Schema

func SecurityGroupsCheck

func SecurityGroupsCheck(prefix, subscriptionID, resourceGroup string, exposePrometheus, exposeSSH bool) error

SecurityGroupsCheck checks that all SG rules has been applied correctly

func VirtualMachineScaleSetIPAddressIDsByLocation

func VirtualMachineScaleSetIPAddressIDsByLocation(vmScaleSets []compute.VirtualMachineScaleSet, subscriptionID, resourceGroup string) (map[string][]string, error)

VirtualMachineScaleSetIPAddressIDsByLocation returns VMs by location map

func VolumesCheck

func VolumesCheck(prefix, subscriptionID, resourceGroup string, vms VMSMap) error

VolumesCheck checks virtual machine scale set health status

func WaitValidatorMetricNameForMetricNamespace

func WaitValidatorMetricNameForMetricNamespace(
	ctx context.Context,
	client *insights.MetricDefinitionsClient,
	vmScaleSetName,
	resourceGroup,
	metricName,
	metricNameSpace string,
) (string, error)

func WaitValidatorMetricNamesForMetricNamespace

func WaitValidatorMetricNamesForMetricNamespace(
	ctx context.Context,
	client *insights.MetricDefinitionsClient,
	vmScaleSetNames []string,
	resourceGroup,
	metricName,
	metricNameSpace string,
	period int,
	attempts int,
) (map[string]string, error)

Types

type IPAddress

type IPAddress struct {
	// /subscriptions/6ad71a09-e4a3-44e0-8e5f-df997c709a74/resourceGroups/814_Protofire_Web3/providers/Microsoft.Compute/virtualMachineScaleSets/test-instance-primary/virtualMachines/0/networkInterfaces/test-ni-primary/ipConfigurations/primary-primary/publicIPAddresses/public-primary
	SubscriptionID      string
	ResourceGroup       string
	VMSSName            string
	VMIndex             string
	IFName              string
	IPConfigurationName string
	PublicAddressName   string
}

IPAddress represents virtual machine scale set IP public address configuration

func IPAddressFromString

func IPAddressFromString(addr string) *IPAddress

IPAddressFromString build struct from string

type VMSMap

VMSMap map location to list of virtual machines

func GetVirtualMachineScaleSetVMs

func GetVirtualMachineScaleSetVMs(prefix, subscriptionID, resourceGroup string) (VMSMap, error)

GetVirtualMachineScaleSetVMs gets all virtual machines

func GetVirtualMachineScaleSetVMsWithClient

func GetVirtualMachineScaleSetVMsWithClient(
	ctx context.Context,
	vmScaleSetClient *compute.VirtualMachineScaleSetsClient,
	vmScaleSetClientVMs *compute.VirtualMachineScaleSetVMsClient,
	prefix,
	resourceGroup string,
	locations ...string,
) (VMSMap, error)

GetVirtualMachineScaleSetVMsWithClient gets all virtual machines

func VirtualMachineScaleSetVMsByLocation

func VirtualMachineScaleSetVMsByLocation(vms VMSMap) VMSMap

VirtualMachineScaleSetVMsByLocation returns VMs by location map

func WaitForVirtualMachineScaleSetVMsWithClient

func WaitForVirtualMachineScaleSetVMsWithClient(
	ctx context.Context,
	vmScaleSetClient *compute.VirtualMachineScaleSetsClient,
	vmScaleSetClientVMs *compute.VirtualMachineScaleSetVMsClient,
	prefix,
	resourceGroup string,
	size int,
	period int,
	locations ...string,
) (VMSMap, error)

func (VMSMap) Size

func (vmss VMSMap) Size() int

type Validator

type Validator struct {
	ScaleSetName string
	Hostname     string
	Metric       int
}

func GetCurrentValidator

func GetCurrentValidator(
	ctx context.Context,
	client *insights.MetricsClient,
	vmScaleSetNames []string,
	resourceGroup,
	metricName,
	metricNameSpace string,
	aggregator insights.AggregationType,
) (Validator, error)

func WaitForValidator

func WaitForValidator(
	ctx context.Context,
	client *insights.MetricsClient,
	vmScaleSetNames []string,
	resourceGroup,
	metricName,
	metricNamespace string,
	period int,
) (Validator, error)

WaitForValidator waits while validator metrics is being appeared

Jump to

Keyboard shortcuts

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