package
0.20240715.1103416
Repository: https://github.com/hashicorp/go-azure-sdk.git
Documentation: pkg.go.dev
# README
github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines
Documentation
The virtualmachines
SDK allows for interaction with the Azure Resource Manager Service devtestlab
(API Version 2018-09-15
).
This readme covers example usages, but further information on using this SDK can be found in the project root.
Import Path
import "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines"
Client Initialization
client := virtualmachines.NewVirtualMachinesClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer
Example Usage: VirtualMachinesClient.AddDataDisk
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
payload := virtualmachines.DataDiskProperties{
// ...
}
if err := client.AddDataDiskThenPoll(ctx, id, payload); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.ApplyArtifacts
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
payload := virtualmachines.ApplyArtifactsRequest{
// ...
}
if err := client.ApplyArtifactsThenPoll(ctx, id, payload); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.Claim
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
if err := client.ClaimThenPoll(ctx, id); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.CreateOrUpdate
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
payload := virtualmachines.LabVirtualMachine{
// ...
}
if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.Delete
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
if err := client.DeleteThenPoll(ctx, id); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.DetachDataDisk
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
payload := virtualmachines.DetachDataDiskProperties{
// ...
}
if err := client.DetachDataDiskThenPoll(ctx, id, payload); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.Get
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
read, err := client.Get(ctx, id, virtualmachines.DefaultGetOperationOptions())
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: VirtualMachinesClient.GetRdpFileContents
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
read, err := client.GetRdpFileContents(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: VirtualMachinesClient.List
ctx := context.TODO()
id := virtualmachines.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue")
// alternatively `client.List(ctx, id, virtualmachines.DefaultListOperationOptions())` can be used to do batched pagination
items, err := client.ListComplete(ctx, id, virtualmachines.DefaultListOperationOptions())
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
Example Usage: VirtualMachinesClient.ListApplicableSchedules
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
read, err := client.ListApplicableSchedules(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
Example Usage: VirtualMachinesClient.Redeploy
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
if err := client.RedeployThenPoll(ctx, id); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.Resize
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
payload := virtualmachines.ResizeLabVirtualMachineProperties{
// ...
}
if err := client.ResizeThenPoll(ctx, id, payload); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.Restart
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
if err := client.RestartThenPoll(ctx, id); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.Start
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
if err := client.StartThenPoll(ctx, id); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.Stop
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
if err := client.StopThenPoll(ctx, id); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.TransferDisks
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
if err := client.TransferDisksThenPoll(ctx, id); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.UnClaim
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
if err := client.UnClaimThenPoll(ctx, id); err != nil {
// handle the error
}
Example Usage: VirtualMachinesClient.Update
ctx := context.TODO()
id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")
payload := virtualmachines.UpdateResource{
// ...
}
read, err := client.Update(ctx, id, payload)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}