// 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 armcompute_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/compute/armcompute/v8"
	"log"
)

// Generated from example definition: 2026-03-01/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Create.json
func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginCreateOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", armcompute.VirtualMachineScaleSetVMExtension{
		Properties: &armcompute.VirtualMachineExtensionProperties{
			AutoUpgradeMinorVersion: to.Ptr(true),
			Publisher:               to.Ptr("extPublisher"),
			Type:                    to.Ptr("extType"),
			TypeHandlerVersion:      to.Ptr("1.2"),
			Settings: map[string]any{
				"UserName": "xyz@microsoft.com",
			},
		},
	}, 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 poll 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 = armcompute.VirtualMachineScaleSetVMExtensionsClientCreateOrUpdateResponse{
	// 	VirtualMachineScaleSetVMExtension: armcompute.VirtualMachineScaleSetVMExtension{
	// 		Name: to.Ptr("myVMExtension"),
	// 		Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"),
	// 		ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"),
	// 		Properties: &armcompute.VirtualMachineExtensionProperties{
	// 			AutoUpgradeMinorVersion: to.Ptr(true),
	// 			ProvisioningState: to.Ptr("Creating"),
	// 			Publisher: to.Ptr("extPublisher"),
	// 			Type: to.Ptr("extType"),
	// 			TypeHandlerVersion: to.Ptr("1.2"),
	// 			Settings: map[string]any{
	// 				"UserName": "xyz@microsoft.com",
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-01/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Delete.json
func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", 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 poll 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 = armcompute.VirtualMachineScaleSetVMExtensionsClientDeleteResponse{
	// }
}

// Generated from example definition: 2026-03-01/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.json
func ExampleVirtualMachineScaleSetVMExtensionsClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", 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 = armcompute.VirtualMachineScaleSetVMExtensionsClientGetResponse{
	// 	VirtualMachineScaleSetVMExtension: armcompute.VirtualMachineScaleSetVMExtension{
	// 		Properties: &armcompute.VirtualMachineExtensionProperties{
	// 			AutoUpgradeMinorVersion: to.Ptr(true),
	// 			ProvisioningState: to.Ptr("Creating"),
	// 			Publisher: to.Ptr("extPublisher"),
	// 			Type: to.Ptr("extType"),
	// 			TypeHandlerVersion: to.Ptr("1.2"),
	// 			Settings: map[string]any{
	// 				"UserName": "xyz@microsoft.com",
	// 			},
	// 		},
	// 		Name: to.Ptr("myVMExtension"),
	// 		Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"),
	// 		ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"),
	// 	},
	// }
}

// Generated from example definition: 2026-03-01/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_List.json
func ExampleVirtualMachineScaleSetVMExtensionsClient_List() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().List(ctx, "myResourceGroup", "myvmScaleSet", "0", 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 = armcompute.VirtualMachineScaleSetVMExtensionsClientListResponse{
	// 	VirtualMachineScaleSetVMExtensionsListResult: armcompute.VirtualMachineScaleSetVMExtensionsListResult{
	// 		Value: []*armcompute.VirtualMachineScaleSetVMExtension{
	// 			{
	// 				Properties: &armcompute.VirtualMachineExtensionProperties{
	// 					AutoUpgradeMinorVersion: to.Ptr(true),
	// 					ProvisioningState: to.Ptr("Succeeded"),
	// 					Publisher: to.Ptr("extPublisher"),
	// 					Type: to.Ptr("extType"),
	// 					TypeHandlerVersion: to.Ptr("1.2"),
	// 					Settings: map[string]any{
	// 						"UserName": "xyz@microsoft.com",
	// 					},
	// 				},
	// 				Name: to.Ptr("myVMExtension"),
	// 				Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"),
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"),
	// 			},
	// 			{
	// 				Properties: &armcompute.VirtualMachineExtensionProperties{
	// 					AutoUpgradeMinorVersion: to.Ptr(true),
	// 					ProvisioningState: to.Ptr("Succeeded"),
	// 					Publisher: to.Ptr("extPublisher1"),
	// 					Type: to.Ptr("extType1"),
	// 					TypeHandlerVersion: to.Ptr("1.0"),
	// 					Settings: map[string]any{
	// 						"UserName": "xyz@microsoft.com",
	// 					},
	// 				},
	// 				Name: to.Ptr("myVMExtension1"),
	// 				Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"),
	// 				ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension1"),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-03-01/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Update.json
func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().BeginUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", armcompute.VirtualMachineScaleSetVMExtensionUpdate{
		Properties: &armcompute.VirtualMachineExtensionUpdateProperties{
			AutoUpgradeMinorVersion: to.Ptr(true),
			Publisher:               to.Ptr("extPublisher"),
			Type:                    to.Ptr("extType"),
			TypeHandlerVersion:      to.Ptr("1.2"),
			Settings: map[string]any{
				"UserName": "xyz@microsoft.com",
			},
		},
	}, 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 poll 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 = armcompute.VirtualMachineScaleSetVMExtensionsClientUpdateResponse{
	// 	VirtualMachineScaleSetVMExtension: armcompute.VirtualMachineScaleSetVMExtension{
	// 		Name: to.Ptr("myVMExtension"),
	// 		Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"),
	// 		ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"),
	// 		Properties: &armcompute.VirtualMachineExtensionProperties{
	// 			AutoUpgradeMinorVersion: to.Ptr(true),
	// 			ProvisioningState: to.Ptr("Creating"),
	// 			Publisher: to.Ptr("extPublisher"),
	// 			Type: to.Ptr("extType"),
	// 			TypeHandlerVersion: to.Ptr("1.2"),
	// 			Settings: map[string]any{
	// 				"UserName": "xyz@microsoft.com",
	// 			},
	// 		},
	// 	},
	// }
}
