// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.

package armhdinsight_test

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight/v2"
	"log"
)

// Generated from example definition: 2025-01-15-preview/GetRestartHostsAsyncOperationStatus.json
func ExampleVirtualMachinesClient_GetAsyncOperationStatus() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhdinsight.NewClientFactory("subid", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewVirtualMachinesClient().GetAsyncOperationStatus(ctx, "rg1", "cluster1", "CF938302-6B4D-44A0-A6D2-C0D67E847AEC", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armhdinsight.VirtualMachinesClientGetAsyncOperationStatusResponse{
	// 	AsyncOperationResult: &armhdinsight.AsyncOperationResult{
	// 		Status: to.Ptr(armhdinsight.AsyncOperationStateInProgress),
	// 	},
	// }
}

// Generated from example definition: 2025-01-15-preview/GetClusterVirtualMachines.json
func ExampleVirtualMachinesClient_ListHosts() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhdinsight.NewClientFactory("subid", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewVirtualMachinesClient().ListHosts(ctx, "rg1", "cluster1", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armhdinsight.VirtualMachinesClientListHostsResponse{
	// 	undefined: &[]*armhdinsight.HostInfo{
	// 		{
	// 			Name: to.Ptr("gateway1"),
	// 		},
	// 		{
	// 			Name: to.Ptr("gateway3"),
	// 		},
	// 		{
	// 			Name: to.Ptr("headnode0"),
	// 		},
	// 		{
	// 			Name: to.Ptr("headnode3"),
	// 		},
	// 		{
	// 			Name: to.Ptr("workernode0"),
	// 		},
	// 		{
	// 			Name: to.Ptr("workernode1"),
	// 		},
	// 		{
	// 			Name: to.Ptr("zookeepernode0"),
	// 		},
	// 		{
	// 			Name: to.Ptr("zookeepernode2"),
	// 		},
	// 		{
	// 			Name: to.Ptr("zookeepernode3"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-01-15-preview/RestartVirtualMachinesOperation.json
func ExampleVirtualMachinesClient_BeginRestartHosts() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhdinsight.NewClientFactory("subid", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewVirtualMachinesClient().BeginRestartHosts(ctx, "rg1", "cluster1", []*string{
		to.Ptr("gateway1"),
		to.Ptr("gateway3"),
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armhdinsight.VirtualMachinesClientRestartHostsResponse{
	// }
}
