Documentation
¶
Overview ¶
Example (CreateVM) ¶
Example_createVM creates a group and network artifacts needed for a VM, then creates a VM and tests operations on it.
var groupName = config.GenerateGroupName("VM") // TODO: remove and use local `groupName` only config.SetGroupName(groupName) ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second) defer cancel() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, groupName) if err != nil { util.LogAndPanic(err) } _, err = network.CreateVirtualNetworkAndSubnets(ctx, virtualNetworkName, subnet1Name, subnet2Name) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created vnet and 2 subnets") _, err = network.CreateNetworkSecurityGroup(ctx, nsgName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created network security group") _, err = network.CreatePublicIP(ctx, ipName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created public IP") _, err = network.CreateNIC(ctx, virtualNetworkName, subnet1Name, nsgName, ipName, nicName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created nic") _, err = CreateVM(ctx, vmName, nicName, username, password, sshPublicKeyPath) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created VM") // set or change VM metadata _, err = UpdateVM(ctx, vmName, map[string]*string{ "runtime": to.StringPtr("go"), "cloud": to.StringPtr("azure"), }) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("updated VM") // set or change system state _, err = StartVM(ctx, vmName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("started VM") _, err = RestartVM(ctx, vmName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("restarted VM") _, err = StopVM(ctx, vmName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("stopped VM")
Output: created vnet and 2 subnets created network security group created public IP created nic created VM updated VM started VM restarted VM stopped VM
Example (CreateVMSS) ¶
Example_createVMSS creates a group and network artifacts needed for a VMSS, then creates a VMSS and tests operations on it.
var groupName = config.GenerateGroupName("VMSS") // TODO: remove and use local `groupName` only config.SetGroupName(groupName) ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second) defer cancel() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, groupName) if err != nil { util.LogAndPanic(err) } _, err = network.CreateVirtualNetworkAndSubnets(ctx, virtualNetworkName, subnet1Name, subnet2Name) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created vnet and 2 subnets") _, err = CreateVMSS(ctx, vmssName, virtualNetworkName, subnet1Name, username, password, sshPublicKeyPath) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created VMSS") //set or change VMSS metadata _, err = UpdateVMSS(ctx, vmssName, map[string]*string{ "runtime": to.StringPtr("go"), "cloud": to.StringPtr("azure"), }) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("updated VMSS") // set or change system state _, err = StartVMSS(ctx, vmssName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("started VMSS") _, err = RestartVMSS(ctx, vmssName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("restarted VMSS") _, err = StopVMSS(ctx, vmssName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("stopped VMSS")
Output: created vnet and 2 subnets created VMSS updated VMSS started VMSS restarted VMSS stopped VMSS
Example (CreateVMWithDisks) ¶
var groupName = config.GenerateGroupName("VMWithDisks") // TODO: remove and use local `groupName` only config.SetGroupName(groupName) ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second) defer cancel() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, groupName) if err != nil { util.LogAndPanic(err) } _, err = network.CreateVirtualNetworkAndSubnets(ctx, virtualNetworkName, subnet1Name, subnet2Name) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created vnet and 2 subnets") _, err = network.CreateNetworkSecurityGroup(ctx, nsgName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created network security group") _, err = network.CreatePublicIP(ctx, ipName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created public IP") _, err = network.CreateNIC(ctx, virtualNetworkName, subnet1Name, nsgName, ipName, nicName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created nic") // Disks _, err = AttachDataDisk(ctx, vmName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("attached data disks") _, err = DetachDataDisks(ctx, vmName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("detached data disks") _, err = UpdateOSDiskSize(ctx, vmName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("updated OS disk size")
Output: attached data disks detached data disks updated OS disk size
Example (CreateVMWithEncryptedDisks) ¶
vaultName := randname.GenerateWithPrefix("gosdk-vault", 10) var groupName = config.GenerateGroupName("VMWithEncryptedDisks") config.SetGroupName(groupName) ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second) defer cancel() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, config.GroupName()) if err != nil { util.LogAndPanic(err) } _, err = network.CreateVirtualNetworkAndSubnets(ctx, virtualNetworkName, subnet1Name, subnet2Name) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created vnet and subnets") _, err = network.CreatePublicIP(ctx, ipName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created public IP") _, err = network.CreateNIC(ctx, virtualNetworkName, subnet1Name, "", ipName, nicName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created nic") _, err = CreateDisk(ctx, diskName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created disk") _, err = CreateVMWithDisk(ctx, nicName, diskName, vmName, username, password) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created virtual machine") // create a KV Vault and grant rights to current user var userID string currentUser, err := graphrbac.GetCurrentUser(ctx) if err != nil { util.LogAndPanic(err) } userID = *currentUser.ObjectID _, err = keyvault.CreateVaultWithPolicies(ctx, vaultName, userID) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created keyvault") key, err := keyvault.CreateKey(ctx, vaultName, "keyName") if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created key bundle") _, err = AddDiskEncryptionToVM(ctx, vmName, vaultName, *key.Key.Kid) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("added vm encryption extension")
Output: created vnet and subnets created keyvault created disk created public IP created nic created virtual machine created key bundle added vm encryption extension
Example (CreateVMWithMSI) ¶
var groupName = config.GenerateGroupName("VMWithMSI") // TODO: remove and use local `groupName` only config.SetGroupName(groupName) ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second) defer cancel() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, groupName) if err != nil { util.LogAndPanic(err) } _, err = network.CreateVirtualNetworkAndSubnets(ctx, virtualNetworkName, subnet1Name, subnet2Name) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created vnet and 2 subnets") _, err = network.CreateNetworkSecurityGroup(ctx, nsgName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created network security group") _, err = network.CreatePublicIP(ctx, ipName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created public IP") _, err = network.CreateNIC(ctx, virtualNetworkName, subnet1Name, nsgName, ipName, nicName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created nic") _, err = CreateVMWithMSI(ctx, vmName, nicName, username, password) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created VM") _, err = AddIdentityToVM(ctx, vmName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("added MSI extension") vm, err := GetVM(ctx, vmName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("got VM") list, err := authorization.ListRoleDefinitions(ctx, "roleName eq 'Contributor'") if err != nil { util.LogAndPanic(err) } util.PrintAndLog("got role definitions list") _, err = authorization.AssignRole(ctx, *vm.Identity.PrincipalID, *list.Values()[0].ID) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("role assigned")
Output: created vnet and 2 subnets created network security group created public IP created nic created VM added MSI extension got VM got role definitions list role assigned
Example (CreateVMWithUserAssignedIdentity) ¶
var groupName = config.GenerateGroupName("VMWithUserAssignedID") // TODO: remove and use local `groupName` only config.SetGroupName(groupName) ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second) defer cancel() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, groupName) if err != nil { util.LogAndPanic(err) return } _, err = network.CreateVirtualNetworkAndSubnets(ctx, virtualNetworkName, subnet1Name, subnet2Name) if err != nil { util.LogAndPanic(err) return } util.PrintAndLog("created vnet and 2 subnets") _, err = network.CreateNetworkSecurityGroup(ctx, nsgName) if err != nil { util.LogAndPanic(err) return } util.PrintAndLog("created network security group") _, err = network.CreatePublicIP(ctx, ipName) if err != nil { util.LogAndPanic(err) return } util.PrintAndLog("created public IP") _, err = network.CreateNIC(ctx, virtualNetworkName, subnet1Name, nsgName, ipName, nicName) if err != nil { util.LogAndPanic(err) return } util.PrintAndLog("created nic") id1, err := msi.CreateUserAssignedIdentity(groupName, "useridentity1") if err != nil { util.LogAndPanic(err) return } util.PrintAndLog("created first user-assigned identity") _, err = CreateVMWithUserAssignedID(ctx, vmName, nicName, username, password, *id1) if err != nil { util.LogAndPanic(err) return } util.PrintAndLog("created VM") id2, err := msi.CreateUserAssignedIdentity(groupName, "useridentity2") if err != nil { util.LogAndPanic(err) return } util.PrintAndLog("created second user-assigned identity") _, err = AddUserAssignedIDToVM(ctx, vmName, *id2) if err != nil { util.LogAndPanic(err) return } util.PrintAndLog("added second user-assigned identity to VM") _, err = RemoveUserAssignedIDFromVM(ctx, vmName, *id1) if err != nil { util.LogAndPanic(err) return } util.PrintAndLog("removed first user-assigned identity from VM")
Output: created vnet and 2 subnets created network security group created public IP created nic created first user-assigned identity created VM created second user-assigned identity added second user-assigned identity to VM removed first user-assigned identity from VM
Example (CreateVMsWithLoadBalancer) ¶
var groupName = config.GenerateGroupName("VMsWithLoadBalancer") config.SetGroupName(groupName) ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second) defer cancel() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, config.GroupName()) if err != nil { util.LogAndPanic(err) } asName := "as1" _, err = network.CreatePublicIP(ctx, ipName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created public IP") _, err = network.CreateLoadBalancer(ctx, lbName, ipName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created load balancer") _, err = network.CreateVirtualNetwork(ctx, virtualNetworkName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created vnet") _, err = network.CreateVirtualNetworkSubnet(ctx, virtualNetworkName, subnet1Name) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created subnet") _, err = CreateAvailabilitySet(ctx, asName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created availability set") _, err = CreateVMWithLoadBalancer(ctx, "vm1", lbName, virtualNetworkName, subnet1Name, ipName, asName, 0) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created virtual machine on load balance, with NAT rule 1") _, err = CreateVMWithLoadBalancer(ctx, "vm2", lbName, virtualNetworkName, subnet1Name, ipName, asName, 1) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created virtual machine on load balance, with NAT rule 2")
Output: created public IP created load balancer created vnet created subnet created availability set created virtual machine on load balance, with NAT rule 1 created virtual machine on load balance, with NAT rule 2
Example (Get) ¶
// retrieve information about a specific VM vmClient := getVMClient() vm, err := vmClient.Get(context.Background(), config.GroupName(), vmName, compute.InstanceView) if err != nil { util.LogAndPanic(err) } fmt.Printf("Name: %s\n", *vm.Name) fmt.Printf("ID: %s\n", *vm.ID) fmt.Printf("VM size: %s\n", vm.HardwareProfile.VMSize)
Output:
Example (List) ¶
// list the VMs we've created in our resource group by page. // uses the default page size returned by the service. vmClient := getVMClient() for page, err := vmClient.List(context.Background(), config.GroupName()); page.NotDone(); err = page.Next() { if err != nil { util.LogAndPanic(err) } // print out the list of VMs per page for _, vm := range page.Values() { util.PrintAndLog(fmt.Sprintf("found VM with name %s", *vm.Name)) } }
Output:
Example (ListComplete) ¶
// list the VMs we've created in our resource group using an iterator. vmClient := getVMClient() for iter, err := vmClient.ListComplete(context.Background(), config.GroupName()); iter.NotDone(); err = iter.Next() { if err != nil { util.LogAndPanic(err) } util.PrintAndLog(fmt.Sprintf("found VM with name %s", *iter.Value().Name)) }
Output:
Index ¶
- func AddDiskEncryptionToVM(ctx context.Context, vmName, vaultName, keyID string) (ext compute.VirtualMachineExtension, err error)
- func AddIdentityToVM(ctx context.Context, vmName string) (ext compute.VirtualMachineExtension, err error)
- func AddUserAssignedIDToVM(ctx context.Context, vmName string, id msi.Identity) (*compute.VirtualMachine, error)
- func AttachDataDisk(ctx context.Context, vmName string) (vm compute.VirtualMachine, err error)
- func CreateAKS(ctx context.Context, ...) (c containerservice.ManagedCluster, err error)
- func CreateAvailabilitySet(ctx context.Context, asName string) (compute.AvailabilitySet, error)
- func CreateContainerGroup(ctx context.Context, containerGroupName, location, resourceGroupName string) (c containerinstance.ContainerGroup, err error)
- func CreateDisk(ctx context.Context, diskName string) (disk compute.Disk, err error)
- func CreateVM(ctx context.Context, ...) (vm compute.VirtualMachine, err error)
- func CreateVMSS(ctx context.Context, ...) (vmss compute.VirtualMachineScaleSet, err error)
- func CreateVMWithDisk(ctx context.Context, nicName, diskName, vmName, username, password string) (vm compute.VirtualMachine, err error)
- func CreateVMWithLoadBalancer(ctx context.Context, ...) (vm compute.VirtualMachine, err error)
- func CreateVMWithMSI(ctx context.Context, vmName, nicName, username, password string) (vm compute.VirtualMachine, err error)
- func CreateVMWithUserAssignedID(ctx context.Context, vmName, nicName, username, password string, ...) (vm compute.VirtualMachine, err error)
- func DeallocateVM(ctx context.Context, vmName string) (osr autorest.Response, err error)
- func DeallocateVMSS(ctx context.Context, vmssName string) (osr autorest.Response, err error)
- func DeleteAKS(ctx context.Context, resourceGroupName, resourceName string) (c containerservice.ManagedClustersDeleteFuture, err error)
- func DeleteContainerGroup(ctx context.Context, resourceGroupName, containerGroupName string) (c containerinstance.ContainerGroup, err error)
- func DetachDataDisks(ctx context.Context, vmName string) (vm compute.VirtualMachine, err error)
- func GetAKS(ctx context.Context, resourceGroupName, resourceName string) (c containerservice.ManagedCluster, err error)
- func GetAvailabilitySet(ctx context.Context, asName string) (compute.AvailabilitySet, error)
- func GetContainerGroup(ctx context.Context, resourceGroupName, containerGroupName string) (c containerinstance.ContainerGroup, err error)
- func GetVM(ctx context.Context, vmName string) (compute.VirtualMachine, error)
- func GetVMSS(ctx context.Context, vmssName string) (compute.VirtualMachineScaleSet, error)
- func GetVMSSClient() compute.VirtualMachineScaleSetsClient
- func GetVMSSExtensionsClient() compute.VirtualMachineScaleSetExtensionsClient
- func RemoveUserAssignedIDFromVM(ctx context.Context, vmName string, id msi.Identity) (*compute.VirtualMachine, error)
- func RestartVM(ctx context.Context, vmName string) (osr autorest.Response, err error)
- func RestartVMSS(ctx context.Context, vmssName string) (osr autorest.Response, err error)
- func StartVM(ctx context.Context, vmName string) (osr autorest.Response, err error)
- func StartVMSS(ctx context.Context, vmssName string) (osr autorest.Response, err error)
- func StopVM(ctx context.Context, vmName string) (osr autorest.Response, err error)
- func StopVMSS(ctx context.Context, vmssName string) (osr autorest.Response, err error)
- func UpdateContainerGroup(ctx context.Context, resourceGroupName, containerGroupName string) (c containerinstance.ContainerGroup, err error)
- func UpdateOSDiskSize(ctx context.Context, vmName string) (d compute.Disk, err error)
- func UpdateVM(ctx context.Context, vmName string, tags map[string]*string) (vm compute.VirtualMachine, err error)
- func UpdateVMSS(ctx context.Context, vmssName string, tags map[string]*string) (vmss compute.VirtualMachineScaleSet, err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDiskEncryptionToVM ¶
func AddDiskEncryptionToVM(ctx context.Context, vmName, vaultName, keyID string) (ext compute.VirtualMachineExtension, err error)
AddDiskEncryptionToVM adds an extension to a VM to enable use of encryption keys from Key Vault to decrypt disks.
func AddIdentityToVM ¶
func AddIdentityToVM(ctx context.Context, vmName string) (ext compute.VirtualMachineExtension, err error)
AddIdentityToVM adds a managed identity to an existing VM by activating the corresponding VM extension.
func AddUserAssignedIDToVM ¶
func AddUserAssignedIDToVM(ctx context.Context, vmName string, id msi.Identity) (*compute.VirtualMachine, error)
AddUserAssignedIDToVM adds the specified user-assigned identity to the specified pre-existing VM.
func AttachDataDisk ¶
AttachDataDisk attaches a 1GB data disk to the specified VM.
func CreateAKS ¶
func CreateAKS(ctx context.Context, resourceName, location, resourceGroupName, username, sshPublicKeyPath, clientID, clientSecret string, agentPoolCount int32) (c containerservice.ManagedCluster, err error)
CreateAKS creates a new managed Kubernetes cluster
Example ¶
var groupName = config.GenerateGroupName("CreateAKS") config.SetGroupName(groupName) ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(time.Hour*1)) defer cancel() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, config.GroupName()) if err != nil { util.LogAndPanic(err) } _, err = CreateAKS(ctx, aksClusterName, config.Location(), config.GroupName(), aksUsername, aksSSHPublicKeyPath, config.ClientID(), config.ClientSecret(), aksAgentPoolCount) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("created AKS cluster") _, err = GetAKS(ctx, config.GroupName(), aksClusterName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("retrieved AKS cluster") _, err = DeleteAKS(ctx, config.GroupName(), aksClusterName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("deleted AKS cluster")
Output: created AKS cluster retrieved AKS cluster deleted AKS cluster
func CreateAvailabilitySet ¶
CreateAvailabilitySet creates an availability set
func CreateContainerGroup ¶
func CreateContainerGroup(ctx context.Context, containerGroupName, location, resourceGroupName string) (c containerinstance.ContainerGroup, err error)
CreateContainerGroup creates a new container group given a container group name, location and resoruce group
Example ¶
var groupName = config.GenerateGroupName("CreateContainerGroup") config.SetGroupName(groupName) ctx := context.Background() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, groupName) if err != nil { util.LogAndPanic(err) } _, err = CreateContainerGroup(ctx, containerGroupName, config.Location(), groupName) if err != nil { log.Fatalf("cannot create container group: %v", err) } util.PrintAndLog("created container group") c, err := GetContainerGroup(ctx, groupName, containerGroupName) if err != nil { log.Fatalf("cannot get container group %v from resource group %v", containerGroupName, groupName) } if *c.Name != containerGroupName { log.Fatalf("incorrect name of container group: expected %v, got %v", containerGroupName, *c.Name) } util.PrintAndLog("retrieved container group") _, err = UpdateContainerGroup(ctx, groupName, containerGroupName) if err != nil { log.Fatalf("cannot upate container group: %v", err) } util.PrintAndLog("updated container group") _, err = DeleteContainerGroup(ctx, groupName, containerGroupName) if err != nil { log.Fatalf("cannot delete container group %v from resource group %v: %v", containerGroupName, groupName, err) } util.PrintAndLog("deleted container group")
Output: created container group retrieved container group updated container group deleted container group
func CreateDisk ¶
CreateDisk creates an empty 64GB disk which can be attached to a VM.
func CreateVM ¶
func CreateVM(ctx context.Context, vmName, nicName, username, password, sshPublicKeyPath string) (vm compute.VirtualMachine, err error)
CreateVM creates a new virtual machine with the specified name using the specified NIC. Username, password, and sshPublicKeyPath determine logon credentials.
func CreateVMSS ¶
func CreateVMSS(ctx context.Context, vmssName, vnetName, subnetName, username, password, sshPublicKeyPath string) (vmss compute.VirtualMachineScaleSet, err error)
CreateVMSS creates a new virtual machine scale set with the specified name using the specified vnet and subnet. Username, password, and sshPublicKeyPath determine logon credentials.
func CreateVMWithDisk ¶
func CreateVMWithDisk(ctx context.Context, nicName, diskName, vmName, username, password string) (vm compute.VirtualMachine, err error)
CreateVMWithDisk creates a VM, attaching an already existing data disk
func CreateVMWithLoadBalancer ¶
func CreateVMWithLoadBalancer(ctx context.Context, vmName, lbName, vnetName, subnetName, publicipName, availabilitySetName string, natRule int) (vm compute.VirtualMachine, err error)
CreateVMWithLoadBalancer creates a new VM in an availability set. It also creates and configures a load balancer and associates that with the VM's NIC.
func CreateVMWithMSI ¶
func CreateVMWithMSI(ctx context.Context, vmName, nicName, username, password string) (vm compute.VirtualMachine, err error)
CreateVMWithMSI creates a virtual machine with a system-assigned managed identity.
func CreateVMWithUserAssignedID ¶
func CreateVMWithUserAssignedID(ctx context.Context, vmName, nicName, username, password string, id msi.Identity) (vm compute.VirtualMachine, err error)
CreateVMWithUserAssignedID creates a virtual machine with a user-assigned identity.
func DeallocateVM ¶
DeallocateVM deallocates the selected VM
func DeallocateVMSS ¶
DeallocateVMSS deallocates the selected VMSS
func DeleteAKS ¶
func DeleteAKS(ctx context.Context, resourceGroupName, resourceName string) (c containerservice.ManagedClustersDeleteFuture, err error)
DeleteAKS deletes an existing AKS cluster
func DeleteContainerGroup ¶
func DeleteContainerGroup(ctx context.Context, resourceGroupName, containerGroupName string) (c containerinstance.ContainerGroup, err error)
DeleteContainerGroup deletes an existing container group given a resource group name and container group name
func DetachDataDisks ¶
DetachDataDisks detaches all data disks from the selected VM
func GetAKS ¶
func GetAKS(ctx context.Context, resourceGroupName, resourceName string) (c containerservice.ManagedCluster, err error)
GetAKS returns an existing AKS cluster given a resource group name and resource name
func GetAvailabilitySet ¶
GetAvailabilitySet gets info on an availability set
func GetContainerGroup ¶
func GetContainerGroup(ctx context.Context, resourceGroupName, containerGroupName string) (c containerinstance.ContainerGroup, err error)
GetContainerGroup returns an existing container group given a resource group name and container group name
func GetVMSSClient ¶
func GetVMSSClient() compute.VirtualMachineScaleSetsClient
func GetVMSSExtensionsClient ¶
func GetVMSSExtensionsClient() compute.VirtualMachineScaleSetExtensionsClient
func RemoveUserAssignedIDFromVM ¶
func RemoveUserAssignedIDFromVM(ctx context.Context, vmName string, id msi.Identity) (*compute.VirtualMachine, error)
RemoveUserAssignedIDFromVM removes the specified user-assigned identity from the specified pre-existing VM.
func RestartVMSS ¶
RestartVMSS restarts the selected VMSS
func UpdateContainerGroup ¶
func UpdateContainerGroup(ctx context.Context, resourceGroupName, containerGroupName string) (c containerinstance.ContainerGroup, err error)
UpdateContainerGroup updates the image of the first container of an existing container group given a resource group name and container group name
func UpdateOSDiskSize ¶
UpdateOSDiskSize increases the selected VM's OS disk size by 10GB.
func UpdateVM ¶
func UpdateVM(ctx context.Context, vmName string, tags map[string]*string) (vm compute.VirtualMachine, err error)
UpdateVM modifies the VM resource by getting it, updating it locally, and putting it back to the server.
func UpdateVMSS ¶
func UpdateVMSS(ctx context.Context, vmssName string, tags map[string]*string) (vmss compute.VirtualMachineScaleSet, err error)
UpdateVMSS modifies the VMSS resource by getting it, updating it locally, and putting it back to the server.
Types ¶
This section is empty.