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/labservices/2023-06-07/virtualmachine Documentation

The virtualmachine SDK allows for interaction with the Azure Resource Manager Service labservices (API Version 2023-06-07).

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/labservices/2023-06-07/virtualmachine"

Client Initialization

client := virtualmachine.NewVirtualMachineClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer

Example Usage: VirtualMachineClient.Get

ctx := context.TODO()
id := virtualmachine.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")

read, err := client.Get(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: VirtualMachineClient.LabPlansSaveImage

ctx := context.TODO()
id := virtualmachine.NewLabPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labPlanValue")

payload := virtualmachine.SaveImageBody{
	// ...
}


if err := client.LabPlansSaveImageThenPoll(ctx, id, payload); err != nil {
	// handle the error
}

Example Usage: VirtualMachineClient.ListByLab

ctx := context.TODO()
id := virtualmachine.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue")

// alternatively `client.ListByLab(ctx, id)` can be used to do batched pagination
items, err := client.ListByLabComplete(ctx, id)
if err != nil {
	// handle the error
}
for _, item := range items {
	// do something
}

Example Usage: VirtualMachineClient.Redeploy

ctx := context.TODO()
id := virtualmachine.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")

if err := client.RedeployThenPoll(ctx, id); err != nil {
	// handle the error
}

Example Usage: VirtualMachineClient.Reimage

ctx := context.TODO()
id := virtualmachine.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")

if err := client.ReimageThenPoll(ctx, id); err != nil {
	// handle the error
}

Example Usage: VirtualMachineClient.ResetPassword

ctx := context.TODO()
id := virtualmachine.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")

payload := virtualmachine.ResetPasswordBody{
	// ...
}


if err := client.ResetPasswordThenPoll(ctx, id, payload); err != nil {
	// handle the error
}

Example Usage: VirtualMachineClient.Start

ctx := context.TODO()
id := virtualmachine.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")

if err := client.StartThenPoll(ctx, id); err != nil {
	// handle the error
}

Example Usage: VirtualMachineClient.Stop

ctx := context.TODO()
id := virtualmachine.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue")

if err := client.StopThenPoll(ctx, id); err != nil {
	// handle the error
}