diff --git a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md
index a95789f7f722..9ffd00afaa31 100644
--- a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md
+++ b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md
@@ -1,5 +1,9 @@
# Release History
+## 4.0.1 (2022-10-13)
+### Other Changes
+
+
## 4.0.0 (2022-10-04)
### Breaking Changes
diff --git a/sdk/resourcemanager/compute/armcompute/autorest.md b/sdk/resourcemanager/compute/armcompute/autorest.md
index 3ece0fc20bc5..34d062eadeb2 100644
--- a/sdk/resourcemanager/compute/armcompute/autorest.md
+++ b/sdk/resourcemanager/compute/armcompute/autorest.md
@@ -5,8 +5,8 @@
``` yaml
azure-arm: true
require:
-- https://github.com/Azure/azure-rest-api-specs/blob/20077475fad69cd39ee2408a9c9835bd36a53be3/specification/compute/resource-manager/readme.md
-- https://github.com/Azure/azure-rest-api-specs/blob/20077475fad69cd39ee2408a9c9835bd36a53be3/specification/compute/resource-manager/readme.go.md
+- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/compute/resource-manager/readme.md
+- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/compute/resource-manager/readme.go.md
license-header: MICROSOFT_MIT_NO_VERSION
-module-version: 4.0.0
+module-version: 4.0.1
```
\ No newline at end of file
diff --git a/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go b/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go
deleted file mode 100644
index a732f36ad2f5..000000000000
--- a/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go
+++ /dev/null
@@ -1,293 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySet_Create.json
-func ExampleAvailabilitySetsClient_CreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myAvailabilitySet", armcompute.AvailabilitySet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.AvailabilitySetProperties{
- PlatformFaultDomainCount: to.Ptr[int32](2),
- PlatformUpdateDomainCount: to.Ptr[int32](20),
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Update_MaximumSet_Gen.json
-func ExampleAvailabilitySetsClient_Update_availabilitySetsUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", armcompute.AvailabilitySetUpdate{
- Tags: map[string]*string{
- "key2574": to.Ptr("aaaaaaaa"),
- },
- Properties: &armcompute.AvailabilitySetProperties{
- PlatformFaultDomainCount: to.Ptr[int32](2),
- PlatformUpdateDomainCount: to.Ptr[int32](20),
- ProximityPlacementGroup: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- VirtualMachines: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- }},
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("DSv3-Type1"),
- Capacity: to.Ptr[int64](7),
- Tier: to.Ptr("aaa"),
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Update_MinimumSet_Gen.json
-func ExampleAvailabilitySetsClient_Update_availabilitySetsUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.AvailabilitySetUpdate{}, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Delete_MaximumSet_Gen.json
-func ExampleAvailabilitySetsClient_Delete_availabilitySetsDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.Delete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Delete_MinimumSet_Gen.json
-func ExampleAvailabilitySetsClient_Delete_availabilitySetsDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.Delete(ctx, "rgcompute", "aaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Get_MaximumSet_Gen.json
-func ExampleAvailabilitySetsClient_Get_availabilitySetsGetMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "rgcompute", "aaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_Get_MinimumSet_Gen.json
-func ExampleAvailabilitySetsClient_Get_availabilitySetsGetMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySet_ListBySubscription.json
-func ExampleAvailabilitySetsClient_NewListBySubscriptionPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListBySubscriptionPager(&armcompute.AvailabilitySetsClientListBySubscriptionOptions{Expand: to.Ptr("virtualMachines\\$ref")})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_List_MaximumSet_Gen.json
-func ExampleAvailabilitySetsClient_NewListPager_availabilitySetsListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("rgcompute", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_List_MinimumSet_Gen.json
-func ExampleAvailabilitySetsClient_NewListPager_availabilitySetsListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("rgcompute", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_ListAvailableSizes_MaximumSet_Gen.json
-func ExampleAvailabilitySetsClient_NewListAvailableSizesPager_availabilitySetsListAvailableSizesMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListAvailableSizesPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/availabilitySetExamples/AvailabilitySets_ListAvailableSizes_MinimumSet_Gen.json
-func ExampleAvailabilitySetsClient_NewListAvailableSizesPager_availabilitySetsListAvailableSizesMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewAvailabilitySetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListAvailableSizesPager("rgcompute", "aa", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go b/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go
deleted file mode 100644
index 641080c70daf..000000000000
--- a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go
+++ /dev/null
@@ -1,191 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.json
-func ExampleCapacityReservationGroupsClient_CreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myCapacityReservationGroup", armcompute.CapacityReservationGroup{
- Location: to.Ptr("westus"),
- Tags: map[string]*string{
- "department": to.Ptr("finance"),
- },
- Zones: []*string{
- to.Ptr("1"),
- to.Ptr("2")},
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.json
-func ExampleCapacityReservationGroupsClient_Update_capacityReservationGroupsUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationGroupUpdate{
- Tags: map[string]*string{
- "key5355": to.Ptr("aaa"),
- },
- Properties: &armcompute.CapacityReservationGroupProperties{
- InstanceView: &armcompute.CapacityReservationGroupInstanceView{},
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MinimumSet_Gen.json
-func ExampleCapacityReservationGroupsClient_Update_capacityReservationGroupsUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationGroupUpdate{}, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json
-func ExampleCapacityReservationGroupsClient_Delete_capacityReservationGroupsDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.Delete(ctx, "rgcompute", "a", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json
-func ExampleCapacityReservationGroupsClient_Delete_capacityReservationGroupsDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.Delete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_Get.json
-func ExampleCapacityReservationGroupsClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationGroupsClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myCapacityReservationGroup", &armcompute.CapacityReservationGroupsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationGroupInstanceViewTypesInstanceView)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.json
-func ExampleCapacityReservationGroupsClient_NewListByResourceGroupPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("myResourceGroup", &armcompute.CapacityReservationGroupsClientListByResourceGroupOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.json
-func ExampleCapacityReservationGroupsClient_NewListBySubscriptionPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListBySubscriptionPager(&armcompute.CapacityReservationGroupsClientListBySubscriptionOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go b/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go
deleted file mode 100644
index 13a9ccf42103..000000000000
--- a/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go
+++ /dev/null
@@ -1,207 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "time"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_CreateOrUpdate.json
-func ExampleCapacityReservationsClient_BeginCreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", armcompute.CapacityReservation{
- Location: to.Ptr("westus"),
- Tags: map[string]*string{
- "department": to.Ptr("HR"),
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_DS1_v2"),
- Capacity: to.Ptr[int64](4),
- },
- Zones: []*string{
- to.Ptr("1")},
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json
-func ExampleCapacityReservationsClient_BeginUpdate_capacityReservationsUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationUpdate{
- Tags: map[string]*string{
- "key4974": to.Ptr("aaaaaaaaaaaaaaaa"),
- },
- Properties: &armcompute.CapacityReservationProperties{
- InstanceView: &armcompute.CapacityReservationInstanceView{
- Statuses: []*armcompute.InstanceViewStatus{
- {
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- }},
- UtilizationInfo: &armcompute.CapacityReservationUtilization{},
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_DS1_v2"),
- Capacity: to.Ptr[int64](7),
- Tier: to.Ptr("aaa"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_Update_MinimumSet_Gen.json
-func ExampleCapacityReservationsClient_BeginUpdate_capacityReservationsUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaa", armcompute.CapacityReservationUpdate{}, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json
-func ExampleCapacityReservationsClient_BeginDelete_capacityReservationsDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json
-func ExampleCapacityReservationsClient_BeginDelete_capacityReservationsDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaa", "aaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_Get.json
-func ExampleCapacityReservationsClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationsClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", &armcompute.CapacityReservationsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationInstanceViewTypesInstanceView)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/capacityReservationExamples/CapacityReservation_ListByReservationGroup.json
-func ExampleCapacityReservationsClient_NewListByCapacityReservationGroupPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCapacityReservationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByCapacityReservationGroupPager("myResourceGroup", "myCapacityReservationGroup", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_client_example_test.go
deleted file mode 100644
index 7943f85b04b5..000000000000
--- a/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_client_example_test.go
+++ /dev/null
@@ -1,103 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceOSVersion_Get.json
-func ExampleCloudServiceOperatingSystemsClient_GetOSVersion() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceOperatingSystemsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetOSVersion(ctx, "westus2", "WA-GUEST-OS-3.90_202010-02", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceOSVersion_List.json
-func ExampleCloudServiceOperatingSystemsClient_NewListOSVersionsPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceOperatingSystemsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListOSVersionsPager("westus2", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceOSFamily_Get.json
-func ExampleCloudServiceOperatingSystemsClient_GetOSFamily() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceOperatingSystemsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetOSFamily(ctx, "westus2", "3", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceOSFamilies_List.json
-func ExampleCloudServiceOperatingSystemsClient_NewListOSFamiliesPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceOperatingSystemsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListOSFamiliesPager("westus2", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go
deleted file mode 100644
index 7888b485ac67..000000000000
--- a/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go
+++ /dev/null
@@ -1,180 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Delete.json
-func ExampleCloudServiceRoleInstancesClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Get.json
-func ExampleCloudServiceRoleInstancesClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Get_InstanceView.json
-func ExampleCloudServiceRoleInstancesClient_GetInstanceView() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetInstanceView(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRolesInstance_List.json
-func ExampleCloudServiceRoleInstancesClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientListOptions{Expand: nil})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Restart.json
-func ExampleCloudServiceRoleInstancesClient_BeginRestart() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRestart(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Reimage.json
-func ExampleCloudServiceRoleInstancesClient_BeginReimage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimage(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Rebuild.json
-func ExampleCloudServiceRoleInstancesClient_BeginRebuild() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRebuild(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Get_RemoteDesktopFile.json
-func ExampleCloudServiceRoleInstancesClient_GetRemoteDesktopFile() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceRoleInstancesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.GetRemoteDesktopFile(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "rgcloudService", "aaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go
deleted file mode 100644
index f6d60663d24c..000000000000
--- a/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRole_Get.json
-func ExampleCloudServiceRolesClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceRolesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "{role-name}", "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRole_List.json
-func ExampleCloudServiceRolesClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServiceRolesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("ConstosoRG", "{cs-name}", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go
deleted file mode 100644
index b8ef72f446f3..000000000000
--- a/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go
+++ /dev/null
@@ -1,564 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Create_WithMultiRole.json
-func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithMultipleRoles() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
- Location: to.Ptr("westus"),
- Properties: &armcompute.CloudServiceProperties{
- Configuration: to.Ptr("{ServiceConfiguration}"),
- NetworkProfile: &armcompute.CloudServiceNetworkProfile{
- LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
- {
- Name: to.Ptr("contosolb"),
- Properties: &armcompute.LoadBalancerConfigurationProperties{
- FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
- {
- Name: to.Ptr("contosofe"),
- Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
- PublicIPAddress: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
- },
- },
- }},
- },
- }},
- },
- PackageURL: to.Ptr("{PackageUrl}"),
- RoleProfile: &armcompute.CloudServiceRoleProfile{
- Roles: []*armcompute.CloudServiceRoleProfileProperties{
- {
- Name: to.Ptr("ContosoFrontend"),
- SKU: &armcompute.CloudServiceRoleSKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](1),
- Tier: to.Ptr("Standard"),
- },
- },
- {
- Name: to.Ptr("ContosoBackend"),
- SKU: &armcompute.CloudServiceRoleSKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](1),
- Tier: to.Ptr("Standard"),
- },
- }},
- },
- UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Create_WithSingleRole.json
-func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRole() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
- Location: to.Ptr("westus"),
- Properties: &armcompute.CloudServiceProperties{
- Configuration: to.Ptr("{ServiceConfiguration}"),
- NetworkProfile: &armcompute.CloudServiceNetworkProfile{
- LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
- {
- Name: to.Ptr("myLoadBalancer"),
- Properties: &armcompute.LoadBalancerConfigurationProperties{
- FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
- {
- Name: to.Ptr("myfe"),
- Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
- PublicIPAddress: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"),
- },
- },
- }},
- },
- }},
- },
- PackageURL: to.Ptr("{PackageUrl}"),
- RoleProfile: &armcompute.CloudServiceRoleProfile{
- Roles: []*armcompute.CloudServiceRoleProfileProperties{
- {
- Name: to.Ptr("ContosoFrontend"),
- SKU: &armcompute.CloudServiceRoleSKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](1),
- Tier: to.Ptr("Standard"),
- },
- }},
- },
- UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Create_WithSingleRoleAndCertificate.json
-func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRoleAndCertificateFromKeyVault() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
- Location: to.Ptr("westus"),
- Properties: &armcompute.CloudServiceProperties{
- Configuration: to.Ptr("{ServiceConfiguration}"),
- NetworkProfile: &armcompute.CloudServiceNetworkProfile{
- LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
- {
- Name: to.Ptr("contosolb"),
- Properties: &armcompute.LoadBalancerConfigurationProperties{
- FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
- {
- Name: to.Ptr("contosofe"),
- Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
- PublicIPAddress: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
- },
- },
- }},
- },
- }},
- },
- OSProfile: &armcompute.CloudServiceOsProfile{
- Secrets: []*armcompute.CloudServiceVaultSecretGroup{
- {
- SourceVault: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"),
- },
- VaultCertificates: []*armcompute.CloudServiceVaultCertificate{
- {
- CertificateURL: to.Ptr("https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"),
- }},
- }},
- },
- PackageURL: to.Ptr("{PackageUrl}"),
- RoleProfile: &armcompute.CloudServiceRoleProfile{
- Roles: []*armcompute.CloudServiceRoleProfileProperties{
- {
- Name: to.Ptr("ContosoFrontend"),
- SKU: &armcompute.CloudServiceRoleSKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](1),
- Tier: to.Ptr("Standard"),
- },
- }},
- },
- UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Create_WithSingleRoleAndRDP.json
-func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRoleAndRdpExtension() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
- Location: to.Ptr("westus"),
- Properties: &armcompute.CloudServiceProperties{
- Configuration: to.Ptr("{ServiceConfiguration}"),
- ExtensionProfile: &armcompute.CloudServiceExtensionProfile{
- Extensions: []*armcompute.Extension{
- {
- Name: to.Ptr("RDPExtension"),
- Properties: &armcompute.CloudServiceExtensionProperties{
- Type: to.Ptr("RDP"),
- AutoUpgradeMinorVersion: to.Ptr(false),
- ProtectedSettings: "{password}",
- Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"),
- Settings: "UserAzure10/22/2021 15:05:45",
- TypeHandlerVersion: to.Ptr("1.2"),
- },
- }},
- },
- NetworkProfile: &armcompute.CloudServiceNetworkProfile{
- LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
- {
- Name: to.Ptr("contosolb"),
- Properties: &armcompute.LoadBalancerConfigurationProperties{
- FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
- {
- Name: to.Ptr("contosofe"),
- Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
- PublicIPAddress: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
- },
- },
- }},
- },
- }},
- },
- PackageURL: to.Ptr("{PackageUrl}"),
- RoleProfile: &armcompute.CloudServiceRoleProfile{
- Roles: []*armcompute.CloudServiceRoleProfileProperties{
- {
- Name: to.Ptr("ContosoFrontend"),
- SKU: &armcompute.CloudServiceRoleSKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](1),
- Tier: to.Ptr("Standard"),
- },
- }},
- },
- UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Update_ToIncludeTags.json
-func ExampleCloudServicesClient_BeginUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudServiceUpdate{
- Tags: map[string]*string{
- "Documentation": to.Ptr("RestAPI"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Delete.json
-func ExampleCloudServicesClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Get_WithMultiRoleAndRDP.json
-func ExampleCloudServicesClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Get_InstanceViewWithMultiRole.json
-func ExampleCloudServicesClient_GetInstanceView() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetInstanceView(ctx, "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_List_BySubscription.json
-func ExampleCloudServicesClient_NewListAllPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListAllPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_List_ByResourceGroup.json
-func ExampleCloudServicesClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("ConstosoRG", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_Start.json
-func ExampleCloudServicesClient_BeginStart() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginStart(ctx, "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudService_PowerOff.json
-func ExampleCloudServicesClient_BeginPowerOff() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPowerOff(ctx, "ConstosoRG", "{cs-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Restart_ByCloudService.json
-func ExampleCloudServicesClient_BeginRestart() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRestart(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginRestartOptions{Parameters: &armcompute.RoleInstances{
- RoleInstances: []*string{
- to.Ptr("ContosoFrontend_IN_0"),
- to.Ptr("ContosoBackend_IN_1")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Reimage_ByCloudService.json
-func ExampleCloudServicesClient_BeginReimage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimage(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginReimageOptions{Parameters: &armcompute.RoleInstances{
- RoleInstances: []*string{
- to.Ptr("ContosoFrontend_IN_0"),
- to.Ptr("ContosoBackend_IN_1")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Rebuild_ByCloudService.json
-func ExampleCloudServicesClient_BeginRebuild() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRebuild(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginRebuildOptions{Parameters: &armcompute.RoleInstances{
- RoleInstances: []*string{
- to.Ptr("ContosoFrontend_IN_0"),
- to.Ptr("ContosoBackend_IN_1")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceRoleInstance_Delete_ByCloudService.json
-func ExampleCloudServicesClient_BeginDeleteInstances() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDeleteInstances(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginDeleteInstancesOptions{Parameters: &armcompute.RoleInstances{
- RoleInstances: []*string{
- to.Ptr("ContosoFrontend_IN_0"),
- to.Ptr("ContosoBackend_IN_1")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go
deleted file mode 100644
index 90b7da994449..000000000000
--- a/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceUpdateDomain_Update.json
-func ExampleCloudServicesUpdateDomainClient_BeginWalkUpdateDomain() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesUpdateDomainClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginWalkUpdateDomain(ctx, "ConstosoRG", "{cs-name}", 1, armcompute.UpdateDomain{}, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceUpdateDomain_Get.json
-func ExampleCloudServicesUpdateDomainClient_GetUpdateDomain() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesUpdateDomainClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetUpdateDomain(ctx, "ConstosoRG", "{cs-name}", 1, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-04-04/examples/CloudServiceUpdateDomain_List.json
-func ExampleCloudServicesUpdateDomainClient_NewListUpdateDomainsPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCloudServicesUpdateDomainClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListUpdateDomainsPager("ConstosoRG", "{cs-name}", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go
deleted file mode 100644
index f5fb36c8db2f..000000000000
--- a/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGallery_Get.json
-func ExampleCommunityGalleriesClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCommunityGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myLocation", "publicGalleryName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go
deleted file mode 100644
index 990f08bfdecd..000000000000
--- a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImage_Get.json
-func ExampleCommunityGalleryImagesClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCommunityGalleryImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImage_List.json
-func ExampleCommunityGalleryImagesClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCommunityGalleryImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("myLocation", "publicGalleryName", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go
deleted file mode 100644
index b2aca138c9fb..000000000000
--- a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_Get.json
-func ExampleCommunityGalleryImageVersionsClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCommunityGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", "myGalleryImageVersionName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_List.json
-func ExampleCommunityGalleryImageVersionsClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewCommunityGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("myLocation", "publicGalleryName", "myGalleryImageName", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/constants.go b/sdk/resourcemanager/compute/armcompute/constants.go
index df1e6e5bb565..c40c3054abc1 100644
--- a/sdk/resourcemanager/compute/armcompute/constants.go
+++ b/sdk/resourcemanager/compute/armcompute/constants.go
@@ -11,7 +11,7 @@ package armcompute
const (
moduleName = "armcompute"
- moduleVersion = "v4.0.0"
+ moduleVersion = "v4.0.1"
)
type AccessLevel string
diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go b/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go
deleted file mode 100644
index b4244e223741..000000000000
--- a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go
+++ /dev/null
@@ -1,319 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "time"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.json
-func ExampleDedicatedHostGroupsClient_CreateOrUpdate_createOrUpdateADedicatedHostGroupWithUltraSsdSupport() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", armcompute.DedicatedHostGroup{
- Location: to.Ptr("westus"),
- Tags: map[string]*string{
- "department": to.Ptr("finance"),
- },
- Properties: &armcompute.DedicatedHostGroupProperties{
- AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{
- UltraSSDEnabled: to.Ptr(true),
- },
- PlatformFaultDomainCount: to.Ptr[int32](3),
- SupportAutomaticPlacement: to.Ptr(true),
- },
- Zones: []*string{
- to.Ptr("1")},
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.json
-func ExampleDedicatedHostGroupsClient_CreateOrUpdate_createOrUpdateADedicatedHostGroup() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", armcompute.DedicatedHostGroup{
- Location: to.Ptr("westus"),
- Tags: map[string]*string{
- "department": to.Ptr("finance"),
- },
- Properties: &armcompute.DedicatedHostGroupProperties{
- PlatformFaultDomainCount: to.Ptr[int32](3),
- SupportAutomaticPlacement: to.Ptr(true),
- },
- Zones: []*string{
- to.Ptr("1")},
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_Update_MaximumSet_Gen.json
-func ExampleDedicatedHostGroupsClient_Update_dedicatedHostGroupsUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "rgcompute", "aaaa", armcompute.DedicatedHostGroupUpdate{
- Tags: map[string]*string{
- "key9921": to.Ptr("aaaaaaaaaa"),
- },
- Properties: &armcompute.DedicatedHostGroupProperties{
- InstanceView: &armcompute.DedicatedHostGroupInstanceView{
- Hosts: []*armcompute.DedicatedHostInstanceViewWithName{
- {
- AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
- AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
- {
- Count: to.Ptr[float64](26),
- VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
- }},
- },
- Statuses: []*armcompute.InstanceViewStatus{
- {
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- }},
- }},
- },
- PlatformFaultDomainCount: to.Ptr[int32](3),
- SupportAutomaticPlacement: to.Ptr(true),
- },
- Zones: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")},
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_Update_MinimumSet_Gen.json
-func ExampleDedicatedHostGroupsClient_Update_dedicatedHostGroupsUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.DedicatedHostGroupUpdate{}, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_Delete_MaximumSet_Gen.json
-func ExampleDedicatedHostGroupsClient_Delete_dedicatedHostGroupsDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.Delete(ctx, "rgcompute", "a", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_Delete_MinimumSet_Gen.json
-func ExampleDedicatedHostGroupsClient_Delete_dedicatedHostGroupsDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.Delete(ctx, "rgcompute", "aaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get.json
-func ExampleDedicatedHostGroupsClient_Get_createADedicatedHostGroup() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.json
-func ExampleDedicatedHostGroupsClient_Get_createAnUltraSsdEnabledDedicatedHostGroup() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListByResourceGroup_MaximumSet_Gen.json
-func ExampleDedicatedHostGroupsClient_NewListByResourceGroupPager_dedicatedHostGroupsListByResourceGroupMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("rgcompute", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListByResourceGroup_MinimumSet_Gen.json
-func ExampleDedicatedHostGroupsClient_NewListByResourceGroupPager_dedicatedHostGroupsListByResourceGroupMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("rgcompute", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListBySubscription_MaximumSet_Gen.json
-func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupsListBySubscriptionMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListBySubscriptionPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListBySubscription_MinimumSet_Gen.json
-func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupsListBySubscriptionMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListBySubscriptionPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go b/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go
deleted file mode 100644
index 44aa53e7e447..000000000000
--- a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go
+++ /dev/null
@@ -1,256 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "time"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.json
-func ExampleDedicatedHostsClient_BeginCreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", "myDedicatedHost", armcompute.DedicatedHost{
- Location: to.Ptr("westus"),
- Tags: map[string]*string{
- "department": to.Ptr("HR"),
- },
- Properties: &armcompute.DedicatedHostProperties{
- PlatformFaultDomain: to.Ptr[int32](1),
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("DSv3-Type1"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_Update_MaximumSet_Gen.json
-func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostsUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", armcompute.DedicatedHostUpdate{
- Tags: map[string]*string{
- "key8813": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"),
- },
- Properties: &armcompute.DedicatedHostProperties{
- AutoReplaceOnFailure: to.Ptr(true),
- InstanceView: &armcompute.DedicatedHostInstanceView{
- AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
- AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
- {
- Count: to.Ptr[float64](26),
- VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
- }},
- },
- Statuses: []*armcompute.InstanceViewStatus{
- {
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- }},
- },
- LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid),
- PlatformFaultDomain: to.Ptr[int32](1),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_Update_MinimumSet_Gen.json
-func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostsUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "rgcompute", "aa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.DedicatedHostUpdate{}, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_Delete_MaximumSet_Gen.json
-func ExampleDedicatedHostsClient_BeginDelete_dedicatedHostsDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaa", "aaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_Delete_MinimumSet_Gen.json
-func ExampleDedicatedHostsClient_BeginDelete_dedicatedHostsDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaa", "aaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHost_Get.json
-func ExampleDedicatedHostsClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostsClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", &armcompute.DedicatedHostsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_ListByHostGroup_MaximumSet_Gen.json
-func ExampleDedicatedHostsClient_NewListByHostGroupPager_dedicatedHostsListByHostGroupMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByHostGroupPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHosts_ListByHostGroup_MinimumSet_Gen.json
-func ExampleDedicatedHostsClient_NewListByHostGroupPager_dedicatedHostsListByHostGroupMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByHostGroupPager("rgcompute", "aaaa", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/dedicatedHostExamples/DedicatedHost_Restart.json
-func ExampleDedicatedHostsClient_BeginRestart() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDedicatedHostsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRestart(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go b/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go
deleted file mode 100644
index c69b0098b9c7..000000000000
--- a/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go
+++ /dev/null
@@ -1,291 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Create.json
-func ExampleDiskAccessesClient_BeginCreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskAccess", armcompute.DiskAccess{
- Location: to.Ptr("West US"),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Update.json
-func ExampleDiskAccessesClient_BeginUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDiskAccess", armcompute.DiskAccessUpdate{
- Tags: map[string]*string{
- "department": to.Ptr("Development"),
- "project": to.Ptr("PrivateEndpoints"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json
-func ExampleDiskAccessesClient_Get_getInformationAboutADiskAccessResourceWithPrivateEndpoints() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myDiskAccess", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Get.json
-func ExampleDiskAccessesClient_Get_getInformationAboutADiskAccessResource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myDiskAccess", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Delete.json
-func ExampleDiskAccessesClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myDiskAccess", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_ListByResourceGroup.json
-func ExampleDiskAccessesClient_NewListByResourceGroupPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("myResourceGroup", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_ListBySubscription.json
-func ExampleDiskAccessesClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json
-func ExampleDiskAccessesClient_GetPrivateLinkResources() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetPrivateLinkResources(ctx, "myResourceGroup", "myDiskAccess", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json
-func ExampleDiskAccessesClient_BeginUpdateAPrivateEndpointConnection() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdateAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", armcompute.PrivateEndpointConnection{
- Properties: &armcompute.PrivateEndpointConnectionProperties{
- PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{
- Description: to.Ptr("Approving myPrivateEndpointConnection"),
- Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json
-func ExampleDiskAccessesClient_GetAPrivateEndpointConnection() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json
-func ExampleDiskAccessesClient_BeginDeleteAPrivateEndpointConnection() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDeleteAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json
-func ExampleDiskAccessesClient_NewListPrivateEndpointConnectionsPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskAccessesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPrivateEndpointConnectionsPager("myResourceGroup", "myDiskAccess", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go b/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go
deleted file mode 100644
index dc4beca79219..000000000000
--- a/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go
+++ /dev/null
@@ -1,363 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.json
-func ExampleDiskEncryptionSetsClient_BeginCreateOrUpdate_createADiskEncryptionSetWithKeyVaultFromADifferentSubscription() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{
- Location: to.Ptr("West US"),
- Identity: &armcompute.EncryptionSetIdentity{
- Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
- },
- Properties: &armcompute.EncryptionSetProperties{
- ActiveKey: &armcompute.KeyForDiskEncryptionSet{
- KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}"),
- },
- EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.json
-func ExampleDiskEncryptionSetsClient_BeginCreateOrUpdate_createADiskEncryptionSetWithKeyVaultFromADifferentTenant() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{
- Location: to.Ptr("West US"),
- Identity: &armcompute.EncryptionSetIdentity{
- Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeUserAssigned),
- UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{
- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}": {},
- },
- },
- Properties: &armcompute.EncryptionSetProperties{
- ActiveKey: &armcompute.KeyForDiskEncryptionSet{
- KeyURL: to.Ptr("https://myvaultdifferenttenant.vault-int.azure-int.net/keys/{key}"),
- },
- EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
- FederatedClientID: to.Ptr("00000000-0000-0000-0000-000000000000"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create.json
-func ExampleDiskEncryptionSetsClient_BeginCreateOrUpdate_createADiskEncryptionSet() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{
- Location: to.Ptr("West US"),
- Identity: &armcompute.EncryptionSetIdentity{
- Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
- },
- Properties: &armcompute.EncryptionSetProperties{
- ActiveKey: &armcompute.KeyForDiskEncryptionSet{
- KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"),
- SourceVault: &armcompute.SourceVault{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
- },
- },
- EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.json
-func ExampleDiskEncryptionSetsClient_BeginUpdate_updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{
- Identity: &armcompute.EncryptionSetIdentity{
- Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
- },
- Properties: &armcompute.DiskEncryptionSetUpdateProperties{
- ActiveKey: &armcompute.KeyForDiskEncryptionSet{
- KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"),
- },
- EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
- RotationToLatestKeyVersionEnabled: to.Ptr(true),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.json
-func ExampleDiskEncryptionSetsClient_BeginUpdate_updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{
- Identity: &armcompute.EncryptionSetIdentity{
- Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned),
- },
- Properties: &armcompute.DiskEncryptionSetUpdateProperties{
- ActiveKey: &armcompute.KeyForDiskEncryptionSet{
- KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"),
- },
- EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
- RotationToLatestKeyVersionEnabled: to.Ptr(true),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update.json
-func ExampleDiskEncryptionSetsClient_BeginUpdate_updateADiskEncryptionSet() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{
- Properties: &armcompute.DiskEncryptionSetUpdateProperties{
- ActiveKey: &armcompute.KeyForDiskEncryptionSet{
- KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion"),
- SourceVault: &armcompute.SourceVault{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"),
- },
- },
- EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey),
- },
- Tags: map[string]*string{
- "department": to.Ptr("Development"),
- "project": to.Ptr("Encryption"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json
-func ExampleDiskEncryptionSetsClient_Get_getInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myDiskEncryptionSet", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get.json
-func ExampleDiskEncryptionSetsClient_Get_getInformationAboutADiskEncryptionSet() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myDiskEncryptionSet", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json
-func ExampleDiskEncryptionSetsClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myDiskEncryptionSet", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json
-func ExampleDiskEncryptionSetsClient_NewListByResourceGroupPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("myResourceGroup", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json
-func ExampleDiskEncryptionSetsClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json
-func ExampleDiskEncryptionSetsClient_NewListAssociatedResourcesPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskEncryptionSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListAssociatedResourcesPager("myResourceGroup", "myDiskEncryptionSet", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go b/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go
deleted file mode 100644
index b3958965ebaa..000000000000
--- a/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go
+++ /dev/null
@@ -1,127 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_Get.json
-func ExampleDiskRestorePointClient_Get_getAnIncrementalDiskRestorePointResource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskRestorePointClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json
-func ExampleDiskRestorePointClient_Get_getAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskRestorePointClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json
-func ExampleDiskRestorePointClient_NewListByRestorePointPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskRestorePointClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByRestorePointPager("myResourceGroup", "rpc", "vmrp", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json
-func ExampleDiskRestorePointClient_BeginGrantAccess() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskRestorePointClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginGrantAccess(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", armcompute.GrantAccessData{
- Access: to.Ptr(armcompute.AccessLevelRead),
- DurationInSeconds: to.Ptr[int32](300),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json
-func ExampleDiskRestorePointClient_BeginRevokeAccess() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDiskRestorePointClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRevokeAccess(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go b/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go
deleted file mode 100644
index 99c6c4315a05..000000000000
--- a/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go
+++ /dev/null
@@ -1,1274 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAConfidentialVmSupportedDiskEncryptedWithCustomerManagedKey() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
- ImageReference: &armcompute.ImageDiskReference{
- ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"),
- },
- },
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- SecurityProfile: &armcompute.DiskSecurityProfile{
- SecureVMDiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"),
- SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithDiskAccess.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskAndAssociateWithDiskAccessResource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
- },
- DiskAccessID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"),
- DiskSizeGB: to.Ptr[int32](200),
- NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowPrivate),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithDiskEncryptionSet.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskAndAssociateWithDiskEncryptionSet() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
- },
- DiskSizeGB: to.Ptr[int32](200),
- Encryption: &armcompute.Encryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ByCopyingASnapshot.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByCopyingASnapshot() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
- SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
- SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
- StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
- SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromImportSecure.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromImportSecureCreateOption() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionImportSecure),
- SecurityDataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"),
- SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
- StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
- },
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- SecurityProfile: &armcompute.DiskSecurityProfile{
- SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromUploadPreparedSecure.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromUploadPreparedSecureCreateOption() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionUploadPreparedSecure),
- UploadSizeBytes: to.Ptr[int64](10737418752),
- },
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- SecurityProfile: &armcompute.DiskSecurityProfile{
- SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAPlatformImage.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAPlatformImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
- ImageReference: &armcompute.ImageDiskReference{
- ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"),
- },
- },
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryCommunityImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
- GalleryImageReference: &armcompute.ImageDiskReference{
- CommunityGalleryImageID: to.Ptr("/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"),
- },
- },
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryDirectSharedImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
- GalleryImageReference: &armcompute.ImageDiskReference{
- SharedGalleryImageID: to.Ptr("/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"),
- },
- },
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
- GalleryImageReference: &armcompute.ImageDiskReference{
- ID: to.Ptr("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"),
- },
- },
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnExistingManagedDisk.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk2", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
- SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithDataAccessAuthMode.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithDataAccessAuthMode() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
- },
- DataAccessAuthMode: to.Ptr(armcompute.DataAccessAuthModeAzureActiveDirectory),
- DiskSizeGB: to.Ptr[int32](200),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithOptimizedForFrequentAttach() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
- },
- DiskSizeGB: to.Ptr[int32](200),
- OptimizedForFrequentAttach: to.Ptr(true),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_PerformancePlus.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithPerformancePlus() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload),
- PerformancePlus: to.Ptr(true),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithPremiumV2AccountType() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myPremiumV2Disk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
- },
- DiskIOPSReadWrite: to.Ptr[int64](125),
- DiskMBpsReadWrite: to.Ptr[int64](3000),
- DiskSizeGB: to.Ptr[int32](200),
- },
- SKU: &armcompute.DiskSKU{
- Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumV2LRS),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithSecurityProfile.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithSecurityProfile() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("North Central US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
- ImageReference: &armcompute.ImageDiskReference{
- ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"),
- },
- },
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- SecurityProfile: &armcompute.DiskSecurityProfile{
- SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithSSDZRSAccountType.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithSsdZrsAccountType() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
- },
- DiskSizeGB: to.Ptr[int32](200),
- },
- SKU: &armcompute.DiskSKU{
- Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumZRS),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myUltraReadOnlyDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
- LogicalSectorSize: to.Ptr[int32](4096),
- },
- DiskIOPSReadWrite: to.Ptr[int64](125),
- DiskMBpsReadWrite: to.Ptr[int64](3000),
- DiskSizeGB: to.Ptr[int32](200),
- Encryption: &armcompute.Encryption{
- Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
- },
- },
- SKU: &armcompute.DiskSKU{
- Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_UploadDisk.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAManagedUploadDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload),
- UploadSizeBytes: to.Ptr[int64](10737418752),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_InExtendedLocation.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAnEmptyManagedDiskInExtendedLocation() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- ExtendedLocation: &armcompute.ExtendedLocation{
- Name: to.Ptr("{edge-zone-id}"),
- Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone),
- },
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
- },
- DiskSizeGB: to.Ptr[int32](200),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_Empty.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAnEmptyManagedDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
- },
- DiskSizeGB: to.Ptr[int32](200),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithLogicalSectorSize.json
-func ExampleDisksClient_BeginCreateOrUpdate_createAnUltraManagedDiskWithLogicalSectorSize512E() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
- Location: to.Ptr("West US"),
- Properties: &armcompute.DiskProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
- LogicalSectorSize: to.Ptr[int32](512),
- },
- DiskSizeGB: to.Ptr[int32](200),
- },
- SKU: &armcompute.DiskSKU{
- Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json
-func ExampleDisksClient_BeginUpdate_createOrUpdateABurstingEnabledManagedDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
- Properties: &armcompute.DiskUpdateProperties{
- BurstingEnabled: to.Ptr(true),
- DiskSizeGB: to.Ptr[int32](1024),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddAcceleratedNetworking.json
-func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddAcceleratedNetworking() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
- Properties: &armcompute.DiskUpdateProperties{
- SupportedCapabilities: &armcompute.SupportedCapabilities{
- AcceleratedNetwork: to.Ptr(false),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_ToAddArchitecture.json
-func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddArchitecture() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
- Properties: &armcompute.DiskUpdateProperties{
- SupportedCapabilities: &armcompute.SupportedCapabilities{
- Architecture: to.Ptr(armcompute.ArchitectureArm64),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddPurchasePlan.json
-func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddPurchasePlan() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
- Properties: &armcompute.DiskUpdateProperties{
- PurchasePlan: &armcompute.DiskPurchasePlan{
- Name: to.Ptr("myPurchasePlanName"),
- Product: to.Ptr("myPurchasePlanProduct"),
- PromotionCode: to.Ptr("myPurchasePlanPromotionCode"),
- Publisher: to.Ptr("myPurchasePlanPublisher"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddSupportsHibernation.json
-func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddSupportsHibernation() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
- Properties: &armcompute.DiskUpdateProperties{
- SupportsHibernation: to.Ptr(true),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_ChangeTier.json
-func ExampleDisksClient_BeginUpdate_updateAManagedDiskToChangeTier() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
- Properties: &armcompute.DiskUpdateProperties{
- Tier: to.Ptr("P30"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_DisableBursting.json
-func ExampleDisksClient_BeginUpdate_updateAManagedDiskToDisableBursting() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
- Properties: &armcompute.DiskUpdateProperties{
- BurstingEnabled: to.Ptr(false),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json
-func ExampleDisksClient_BeginUpdate_updateAManagedDiskToDisableOptimizedForFrequentAttach() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
- Properties: &armcompute.DiskUpdateProperties{
- OptimizedForFrequentAttach: to.Ptr(false),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddDiskControllerTypes.json
-func ExampleDisksClient_BeginUpdate_updateAManagedDiskWithDiskControllerTypes() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
- Properties: &armcompute.DiskUpdateProperties{
- SupportedCapabilities: &armcompute.SupportedCapabilities{
- DiskControllerTypes: to.Ptr("SCSI"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_RemoveDiskAccess.json
-func ExampleDisksClient_BeginUpdate_updateManagedDiskToRemoveDiskAccessResourceAssociation() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
- Properties: &armcompute.DiskUpdateProperties{
- NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Get.json
-func ExampleDisksClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myManagedDisk", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Delete.json
-func ExampleDisksClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myDisk", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_ListByResourceGroup.json
-func ExampleDisksClient_NewListByResourceGroupPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("myResourceGroup", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_ListBySubscription.json
-func ExampleDisksClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_BeginGetAccess.json
-func ExampleDisksClient_BeginGrantAccess_getASasOnAManagedDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginGrantAccess(ctx, "myResourceGroup", "myDisk", armcompute.GrantAccessData{
- Access: to.Ptr(armcompute.AccessLevelRead),
- DurationInSeconds: to.Ptr[int32](300),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_BeginGetAccess_WithVMGuestState.json
-func ExampleDisksClient_BeginGrantAccess_getSasOnManagedDiskAndVmGuestState() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginGrantAccess(ctx, "myResourceGroup", "myDisk", armcompute.GrantAccessData{
- Access: to.Ptr(armcompute.AccessLevelRead),
- DurationInSeconds: to.Ptr[int32](300),
- GetSecureVMGuestStateSAS: to.Ptr(true),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_EndGetAccess.json
-func ExampleDisksClient_BeginRevokeAccess() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewDisksClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRevokeAccess(ctx, "myResourceGroup", "myDisk", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go
deleted file mode 100644
index fbb1d45559dd..000000000000
--- a/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go
+++ /dev/null
@@ -1,325 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/CommunityGallery_Create.json
-func ExampleGalleriesClient_BeginCreateOrUpdate_createACommunityGallery() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryProperties{
- Description: to.Ptr("This is the gallery description."),
- SharingProfile: &armcompute.SharingProfile{
- CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{
- Eula: to.Ptr("eula"),
- PublicNamePrefix: to.Ptr("PirPublic"),
- PublisherContact: to.Ptr("pir@microsoft.com"),
- PublisherURI: to.Ptr("uri"),
- },
- Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Create_WithSharingProfile.json
-func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryWithSharingProfile() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryProperties{
- Description: to.Ptr("This is the gallery description."),
- SharingProfile: &armcompute.SharingProfile{
- Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Create_SoftDeletionEnabled.json
-func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryWithSoftDeletionEnabled() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryProperties{
- Description: to.Ptr("This is the gallery description."),
- SoftDeletePolicy: &armcompute.SoftDeletePolicy{
- IsSoftDeleteEnabled: to.Ptr(true),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Create.json
-func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGallery() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryProperties{
- Description: to.Ptr("This is the gallery description."),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Update.json
-func ExampleGalleriesClient_BeginUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.GalleryUpdate{
- Properties: &armcompute.GalleryProperties{
- Description: to.Ptr("This is the gallery description."),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/CommunityGallery_Get.json
-func ExampleGalleriesClient_Get_getACommunityGallery() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil,
- Expand: nil,
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json
-func ExampleGalleriesClient_Get_getAGalleryWithExpandSharingProfileGroups() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil,
- Expand: to.Ptr(armcompute.GalleryExpandParamsSharingProfileGroups),
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get_WithSelectPermissions.json
-func ExampleGalleriesClient_Get_getAGalleryWithSelectPermissions() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: to.Ptr(armcompute.SelectPermissionsPermissions),
- Expand: nil,
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get.json
-func ExampleGalleriesClient_Get_getAGallery() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil,
- Expand: nil,
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Delete.json
-func ExampleGalleriesClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myGalleryName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_ListByResourceGroup.json
-func ExampleGalleriesClient_NewListByResourceGroupPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("myResourceGroup", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_ListBySubscription.json
-func ExampleGalleriesClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go
deleted file mode 100644
index f3e1324c70d2..000000000000
--- a/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go
+++ /dev/null
@@ -1,173 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Create.json
-func ExampleGalleryApplicationsClient_BeginCreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", armcompute.GalleryApplication{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryApplicationProperties{
- Description: to.Ptr("This is the gallery application description."),
- CustomActions: []*armcompute.GalleryApplicationCustomAction{
- {
- Name: to.Ptr("myCustomAction"),
- Description: to.Ptr("This is the custom action description."),
- Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
- {
- Name: to.Ptr("myCustomActionParameter"),
- Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
- Description: to.Ptr("This is the description of the parameter"),
- DefaultValue: to.Ptr("default value of parameter."),
- Required: to.Ptr(false),
- }},
- Script: to.Ptr("myCustomActionScript"),
- }},
- Eula: to.Ptr("This is the gallery application EULA."),
- PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
- ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
- SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Update.json
-func ExampleGalleryApplicationsClient_BeginUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", armcompute.GalleryApplicationUpdate{
- Properties: &armcompute.GalleryApplicationProperties{
- Description: to.Ptr("This is the gallery application description."),
- CustomActions: []*armcompute.GalleryApplicationCustomAction{
- {
- Name: to.Ptr("myCustomAction"),
- Description: to.Ptr("This is the custom action description."),
- Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
- {
- Name: to.Ptr("myCustomActionParameter"),
- Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
- Description: to.Ptr("This is the description of the parameter"),
- DefaultValue: to.Ptr("default value of parameter."),
- Required: to.Ptr(false),
- }},
- Script: to.Ptr("myCustomActionScript"),
- }},
- Eula: to.Ptr("This is the gallery application EULA."),
- PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
- ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
- SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Get.json
-func ExampleGalleryApplicationsClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Delete.json
-func ExampleGalleryApplicationsClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_ListByGallery.json
-func ExampleGalleryApplicationsClient_NewListByGalleryPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByGalleryPager("myResourceGroup", "myGalleryName", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go
deleted file mode 100644
index 8871c5b314bf..000000000000
--- a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go
+++ /dev/null
@@ -1,214 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "time"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Create.json
-func ExampleGalleryApplicationVersionsClient_BeginCreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", armcompute.GalleryApplicationVersion{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryApplicationVersionProperties{
- PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{
- EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00Z"); return t }()),
- ReplicaCount: to.Ptr[int32](1),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](1),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
- }},
- CustomActions: []*armcompute.GalleryApplicationCustomAction{
- {
- Name: to.Ptr("myCustomAction"),
- Description: to.Ptr("This is the custom action description."),
- Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
- {
- Name: to.Ptr("myCustomActionParameter"),
- Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
- Description: to.Ptr("This is the description of the parameter"),
- DefaultValue: to.Ptr("default value of parameter."),
- Required: to.Ptr(false),
- }},
- Script: to.Ptr("myCustomActionScript"),
- }},
- ManageActions: &armcompute.UserArtifactManage{
- Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""),
- Remove: to.Ptr("del C:\\package "),
- },
- Source: &armcompute.UserArtifactSource{
- MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"),
- },
- },
- SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{
- AllowDeletionOfReplicatedLocations: to.Ptr(false),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Update.json
-func ExampleGalleryApplicationVersionsClient_BeginUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", armcompute.GalleryApplicationVersionUpdate{
- Properties: &armcompute.GalleryApplicationVersionProperties{
- PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{
- EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00Z"); return t }()),
- ReplicaCount: to.Ptr[int32](1),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](1),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
- }},
- ManageActions: &armcompute.UserArtifactManage{
- Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""),
- Remove: to.Ptr("del C:\\package "),
- },
- Source: &armcompute.UserArtifactSource{
- MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"),
- },
- },
- SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{
- AllowDeletionOfReplicatedLocations: to.Ptr(false),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.json
-func ExampleGalleryApplicationVersionsClient_Get_getAGalleryApplicationVersionWithReplicationStatus() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", &armcompute.GalleryApplicationVersionsClientGetOptions{Expand: to.Ptr(armcompute.ReplicationStatusTypesReplicationStatus)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Get.json
-func ExampleGalleryApplicationVersionsClient_Get_getAGalleryApplicationVersion() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", &armcompute.GalleryApplicationVersionsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Delete.json
-func ExampleGalleryApplicationVersionsClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.json
-func ExampleGalleryApplicationVersionsClient_NewListByGalleryApplicationPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryApplicationVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByGalleryApplicationPager("myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go
deleted file mode 100644
index a2e17d9abfc5..000000000000
--- a/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go
+++ /dev/null
@@ -1,151 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Create.json
-func ExampleGalleryImagesClient_BeginCreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", armcompute.GalleryImage{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryImageProperties{
- HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
- Identifier: &armcompute.GalleryImageIdentifier{
- Offer: to.Ptr("myOfferName"),
- Publisher: to.Ptr("myPublisherName"),
- SKU: to.Ptr("mySkuName"),
- },
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Update.json
-func ExampleGalleryImagesClient_BeginUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", armcompute.GalleryImageUpdate{
- Properties: &armcompute.GalleryImageProperties{
- HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
- Identifier: &armcompute.GalleryImageIdentifier{
- Offer: to.Ptr("myOfferName"),
- Publisher: to.Ptr("myPublisherName"),
- SKU: to.Ptr("mySkuName"),
- },
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Get.json
-func ExampleGalleryImagesClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Delete.json
-func ExampleGalleryImagesClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_ListByGallery.json
-func ExampleGalleryImagesClient_NewListByGalleryPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByGalleryPager("myResourceGroup", "myGalleryName", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go
deleted file mode 100644
index 47b900acc7e6..000000000000
--- a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go
+++ /dev/null
@@ -1,802 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json
-func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVmAsSource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryImageVersionProperties{
- PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](0),
- },
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](2),
- },
- {
- Name: to.Ptr("East US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](0),
- },
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](2),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
- }},
- },
- SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
- AllowDeletionOfReplicatedLocations: to.Ptr(false),
- },
- StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
- Source: &armcompute.GalleryArtifactVersionFullSource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json
-func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingCommunityGalleryImageAsSource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryImageVersionProperties{
- PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](0),
- },
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](1),
- },
- {
- Name: to.Ptr("East US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](0),
- },
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](2),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
- }},
- },
- SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
- AllowDeletionOfReplicatedLocations: to.Ptr(false),
- },
- StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
- Source: &armcompute.GalleryArtifactVersionFullSource{
- CommunityGalleryImageID: to.Ptr("/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"),
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create.json
-func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingManagedImageAsSource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryImageVersionProperties{
- PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](0),
- },
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](1),
- },
- {
- Name: to.Ptr("East US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](0),
- },
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](2),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
- }},
- },
- SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
- AllowDeletionOfReplicatedLocations: to.Ptr(false),
- },
- StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
- Source: &armcompute.GalleryArtifactVersionFullSource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json
-func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingMixOfDisksAndSnapshotsAsASource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryImageVersionProperties{
- PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](1),
- },
- {
- Name: to.Ptr("East US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](2),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
- }},
- },
- SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
- AllowDeletionOfReplicatedLocations: to.Ptr(false),
- },
- StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
- DataDiskImages: []*armcompute.GalleryDataDiskImage{
- {
- HostCaching: to.Ptr(armcompute.HostCachingNone),
- Source: &armcompute.GalleryDiskImageSource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"),
- },
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.GalleryOSDiskImage{
- HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
- Source: &armcompute.GalleryDiskImageSource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json
-func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingShallowReplicationMode() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryImageVersionProperties{
- PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
- ReplicationMode: to.Ptr(armcompute.ReplicationModeShallow),
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](1),
- }},
- },
- SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
- AllowDeletionOfReplicatedLocations: to.Ptr(false),
- },
- StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
- Source: &armcompute.GalleryArtifactVersionFullSource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json
-func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingSharedImageAsSource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryImageVersionProperties{
- PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](0),
- },
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](1),
- },
- {
- Name: to.Ptr("East US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](0),
- },
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](2),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
- }},
- },
- SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
- AllowDeletionOfReplicatedLocations: to.Ptr(false),
- },
- StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
- Source: &armcompute.GalleryArtifactVersionFullSource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"),
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD.json
-func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVhdAsASource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryImageVersionProperties{
- PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](1),
- },
- {
- Name: to.Ptr("East US"),
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](2),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
- }},
- },
- SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
- AllowDeletionOfReplicatedLocations: to.Ptr(false),
- },
- StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
- DataDiskImages: []*armcompute.GalleryDataDiskImage{
- {
- HostCaching: to.Ptr(armcompute.HostCachingNone),
- Source: &armcompute.GalleryDiskImageSource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
- URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
- },
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.GalleryOSDiskImage{
- HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
- Source: &armcompute.GalleryDiskImageSource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
- URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json
-func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionWithTargetExtendedLocationsSpecified() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
- Location: to.Ptr("West US"),
- Properties: &armcompute.GalleryImageVersionProperties{
- PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](0),
- },
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](1),
- },
- {
- Name: to.Ptr("East US"),
- Encryption: &armcompute.EncryptionImages{
- DataDiskImages: []*armcompute.DataDiskImageEncryption{
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](0),
- },
- {
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- Lun: to.Ptr[int32](1),
- }},
- OSDiskImage: &armcompute.OSDiskImageEncryption{
- DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
- },
- },
- ExcludeFromLatest: to.Ptr(false),
- RegionalReplicaCount: to.Ptr[int32](2),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
- }},
- },
- SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
- AllowDeletionOfReplicatedLocations: to.Ptr(false),
- },
- StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
- Source: &armcompute.GalleryArtifactVersionFullSource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Update.json
-func ExampleGalleryImageVersionsClient_BeginUpdate_updateASimpleGalleryImageVersionManagedImageAsSource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersionUpdate{
- Properties: &armcompute.GalleryImageVersionProperties{
- PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- RegionalReplicaCount: to.Ptr[int32](1),
- },
- {
- Name: to.Ptr("East US"),
- RegionalReplicaCount: to.Ptr[int32](2),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
- }},
- },
- StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
- Source: &armcompute.GalleryArtifactVersionFullSource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.json
-func ExampleGalleryImageVersionsClient_BeginUpdate_updateASimpleGalleryImageVersionWithoutSourceId() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersionUpdate{
- Properties: &armcompute.GalleryImageVersionProperties{
- PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
- TargetRegions: []*armcompute.TargetRegion{
- {
- Name: to.Ptr("West US"),
- RegionalReplicaCount: to.Ptr[int32](1),
- },
- {
- Name: to.Ptr("East US"),
- RegionalReplicaCount: to.Ptr[int32](2),
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
- }},
- },
- StorageProfile: &armcompute.GalleryImageVersionStorageProfile{},
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.json
-func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersionWithReplicationStatus() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: to.Ptr(armcompute.ReplicationStatusTypesReplicationStatus)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.json
-func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersionWithSnapshotsAsASource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.json
-func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersionWithVhdAsASource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get.json
-func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersion() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Delete.json
-func ExampleGalleryImageVersionsClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_ListByGalleryImage.json
-func ExampleGalleryImageVersionsClient_NewListByGalleryImagePager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByGalleryImagePager("myResourceGroup", "myGalleryName", "myGalleryImageName", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go b/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go
deleted file mode 100644
index 0f70108686f1..000000000000
--- a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go
+++ /dev/null
@@ -1,105 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_AddToSharingProfile.json
-func ExampleGallerySharingProfileClient_BeginUpdate_addSharingIdToTheSharingProfileOfAGallery() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGallerySharingProfileClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{
- Groups: []*armcompute.SharingProfileGroup{
- {
- Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions),
- IDs: []*string{
- to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"),
- to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")},
- },
- {
- Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants),
- IDs: []*string{
- to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")},
- }},
- OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesAdd),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_ResetSharingProfile.json
-func ExampleGallerySharingProfileClient_BeginUpdate_resetSharingProfileOfAGallery() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGallerySharingProfileClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{
- OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesReset),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_EnableCommunityGallery.json
-func ExampleGallerySharingProfileClient_BeginUpdate_shareAGalleryToCommunity() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewGallerySharingProfileClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{
- OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesEnableCommunity),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/go.mod b/sdk/resourcemanager/compute/armcompute/go.mod
index 5f5224d85d78..fc8aa9eb99b6 100644
--- a/sdk/resourcemanager/compute/armcompute/go.mod
+++ b/sdk/resourcemanager/compute/armcompute/go.mod
@@ -4,7 +4,6 @@ go 1.18
require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0
- github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3 v3.0.1
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.0.0
@@ -12,6 +11,7 @@ require (
)
require (
+ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect
diff --git a/sdk/resourcemanager/compute/armcompute/images_client_example_test.go b/sdk/resourcemanager/compute/armcompute/images_client_example_test.go
deleted file mode 100644
index 0895afc19ba2..000000000000
--- a/sdk/resourcemanager/compute/armcompute/images_client_example_test.go
+++ /dev/null
@@ -1,542 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.json
-func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
- Location: to.Ptr("West US"),
- Properties: &armcompute.ImageProperties{
- StorageProfile: &armcompute.ImageStorageProfile{
- OSDisk: &armcompute.ImageOSDisk{
- BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
- },
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromABlob.json
-func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromABlob() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
- Location: to.Ptr("West US"),
- Properties: &armcompute.ImageProperties{
- StorageProfile: &armcompute.ImageStorageProfile{
- OSDisk: &armcompute.ImageOSDisk{
- BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
- },
- ZoneResilient: to.Ptr(true),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.json
-func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
- Location: to.Ptr("West US"),
- Properties: &armcompute.ImageProperties{
- StorageProfile: &armcompute.ImageStorageProfile{
- OSDisk: &armcompute.ImageOSDisk{
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
- },
- Snapshot: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
- },
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromAManagedDisk.json
-func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromAManagedDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
- Location: to.Ptr("West US"),
- Properties: &armcompute.ImageProperties{
- StorageProfile: &armcompute.ImageStorageProfile{
- OSDisk: &armcompute.ImageOSDisk{
- ManagedDisk: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
- },
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
- },
- ZoneResilient: to.Ptr(true),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.json
-func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
- Location: to.Ptr("West US"),
- Properties: &armcompute.ImageProperties{
- StorageProfile: &armcompute.ImageStorageProfile{
- OSDisk: &armcompute.ImageOSDisk{
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
- },
- ManagedDisk: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
- },
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromASnapshot.json
-func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromASnapshot() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
- Location: to.Ptr("West US"),
- Properties: &armcompute.ImageProperties{
- StorageProfile: &armcompute.ImageStorageProfile{
- OSDisk: &armcompute.ImageOSDisk{
- Snapshot: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
- },
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
- },
- ZoneResilient: to.Ptr(false),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_CreateFromAVM.json
-func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromAnExistingVirtualMachine() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
- Location: to.Ptr("West US"),
- Properties: &armcompute.ImageProperties{
- SourceVirtualMachine: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_Create_DataDiskFromABlobIncluded.json
-func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageThatIncludesADataDiskFromABlob() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
- Location: to.Ptr("West US"),
- Properties: &armcompute.ImageProperties{
- StorageProfile: &armcompute.ImageStorageProfile{
- DataDisks: []*armcompute.ImageDataDisk{
- {
- BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"),
- Lun: to.Ptr[int32](1),
- }},
- OSDisk: &armcompute.ImageOSDisk{
- BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
- },
- ZoneResilient: to.Ptr(false),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.json
-func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
- Location: to.Ptr("West US"),
- Properties: &armcompute.ImageProperties{
- StorageProfile: &armcompute.ImageStorageProfile{
- DataDisks: []*armcompute.ImageDataDisk{
- {
- ManagedDisk: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"),
- },
- Lun: to.Ptr[int32](1),
- }},
- OSDisk: &armcompute.ImageOSDisk{
- ManagedDisk: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"),
- },
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
- },
- ZoneResilient: to.Ptr(false),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.json
-func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageThatIncludesADataDiskFromASnapshot() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{
- Location: to.Ptr("West US"),
- Properties: &armcompute.ImageProperties{
- StorageProfile: &armcompute.ImageStorageProfile{
- DataDisks: []*armcompute.ImageDataDisk{
- {
- Snapshot: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"),
- },
- Lun: to.Ptr[int32](1),
- }},
- OSDisk: &armcompute.ImageOSDisk{
- Snapshot: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
- },
- OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized),
- OSType: to.Ptr(armcompute.OperatingSystemTypesLinux),
- },
- ZoneResilient: to.Ptr(true),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_Update.json
-func ExampleImagesClient_BeginUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myImage", armcompute.ImageUpdate{
- Tags: map[string]*string{
- "department": to.Ptr("HR"),
- },
- Properties: &armcompute.ImageProperties{
- HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypesV1),
- SourceVirtualMachine: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Images_Delete_MaximumSet_Gen.json
-func ExampleImagesClient_BeginDelete_imagesDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Images_Delete_MinimumSet_Gen.json
-func ExampleImagesClient_BeginDelete_imagesDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_Get.json
-func ExampleImagesClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myImage", &armcompute.ImagesClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_ListByResourceGroup.json
-func ExampleImagesClient_NewListByResourceGroupPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("myResourceGroup", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/imageExamples/Image_ListBySubscription.json
-func ExampleImagesClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go b/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go
deleted file mode 100644
index cc2d90cf15eb..000000000000
--- a/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "time"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/logAnalyticExamples/LogAnalytics_RequestRateByInterval.json
-func ExampleLogAnalyticsClient_BeginExportRequestRateByInterval() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewLogAnalyticsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginExportRequestRateByInterval(ctx, "westus", armcompute.RequestRateByIntervalInput{
- BlobContainerSasURI: to.Ptr("https://somesasuri"),
- FromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-21T01:54:06.862601Z"); return t }()),
- GroupByResourceName: to.Ptr(true),
- ToTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-23T01:54:06.862601Z"); return t }()),
- IntervalLength: to.Ptr(armcompute.IntervalInMinsFiveMins),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/logAnalyticExamples/LogAnalytics_ThrottledRequests.json
-func ExampleLogAnalyticsClient_BeginExportThrottledRequests() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewLogAnalyticsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginExportThrottledRequests(ctx, "westus", armcompute.ThrottledRequestsInput{
- BlobContainerSasURI: to.Ptr("https://somesasuri"),
- FromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-21T01:54:06.862601Z"); return t }()),
- GroupByClientApplicationID: to.Ptr(false),
- GroupByOperationName: to.Ptr(true),
- GroupByResourceName: to.Ptr(false),
- GroupByUserAgent: to.Ptr(false),
- ToTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-23T01:54:06.862601Z"); return t }()),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/operations_client_example_test.go b/sdk/resourcemanager/compute/armcompute/operations_client_example_test.go
deleted file mode 100644
index 77779f8ec238..000000000000
--- a/sdk/resourcemanager/compute/armcompute/operations_client_example_test.go
+++ /dev/null
@@ -1,65 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/Operations_List_MaximumSet_Gen.json
-func ExampleOperationsClient_NewListPager_operationsListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewOperationsClient(cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/Operations_List_MinimumSet_Gen.json
-func ExampleOperationsClient_NewListPager_operationsListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewOperationsClient(cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go b/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go
deleted file mode 100644
index b067fbe22984..000000000000
--- a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go
+++ /dev/null
@@ -1,156 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.json
-func ExampleProximityPlacementGroupsClient_CreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myProximityPlacementGroup", armcompute.ProximityPlacementGroup{
- Location: to.Ptr("westus"),
- Properties: &armcompute.ProximityPlacementGroupProperties{
- Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{
- VMSizes: []*string{
- to.Ptr("Basic_A0"),
- to.Ptr("Basic_A2")},
- },
- ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard),
- },
- Zones: []*string{
- to.Ptr("1")},
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.json
-func ExampleProximityPlacementGroupsClient_Update() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "myResourceGroup", "myProximityPlacementGroup", armcompute.ProximityPlacementGroupUpdate{
- Tags: map[string]*string{
- "additionalProp1": to.Ptr("string"),
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.json
-func ExampleProximityPlacementGroupsClient_Delete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.Delete(ctx, "myResourceGroup", "myProximityPlacementGroup", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.json
-func ExampleProximityPlacementGroupsClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myProximityPlacementGroup", &armcompute.ProximityPlacementGroupsClientGetOptions{IncludeColocationStatus: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.json
-func ExampleProximityPlacementGroupsClient_NewListBySubscriptionPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListBySubscriptionPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.json
-func ExampleProximityPlacementGroupsClient_NewListByResourceGroupPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewProximityPlacementGroupsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("myResourceGroup", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go b/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go
deleted file mode 100644
index 224d3d1f05fa..000000000000
--- a/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go
+++ /dev/null
@@ -1,96 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkus.json
-func ExampleResourceSKUsClient_NewListPager_listsAllAvailableResourceSkUs() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewResourceSKUsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil,
- IncludeExtendedLocations: nil,
- })
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkusForARegion.json
-func ExampleResourceSKUsClient_NewListPager_listsAllAvailableResourceSkUsForTheSpecifiedRegion() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewResourceSKUsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: to.Ptr("location eq 'westus'"),
- IncludeExtendedLocations: nil,
- })
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkusWithExtendedLocations.json
-func ExampleResourceSKUsClient_NewListPager_listsAllAvailableResourceSkUsWithExtendedLocationInformation() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewResourceSKUsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil,
- IncludeExtendedLocations: to.Ptr("true"),
- })
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go b/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go
deleted file mode 100644
index 0ccc718774de..000000000000
--- a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go
+++ /dev/null
@@ -1,251 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.json
-func ExampleRestorePointCollectionsClient_CreateOrUpdate_createOrUpdateARestorePointCollectionForCrossRegionCopy() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myRpc", armcompute.RestorePointCollection{
- Location: to.Ptr("norwayeast"),
- Tags: map[string]*string{
- "myTag1": to.Ptr("tagValue1"),
- },
- Properties: &armcompute.RestorePointCollectionProperties{
- Source: &armcompute.RestorePointCollectionSourceProperties{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName"),
- },
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_CreateOrUpdate.json
-func ExampleRestorePointCollectionsClient_CreateOrUpdate_createOrUpdateARestorePointCollection() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.CreateOrUpdate(ctx, "myResourceGroup", "myRpc", armcompute.RestorePointCollection{
- Location: to.Ptr("norwayeast"),
- Tags: map[string]*string{
- "myTag1": to.Ptr("tagValue1"),
- },
- Properties: &armcompute.RestorePointCollectionProperties{
- Source: &armcompute.RestorePointCollectionSourceProperties{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"),
- },
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollections_Update_MaximumSet_Gen.json
-func ExampleRestorePointCollectionsClient_Update_restorePointCollectionsUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.RestorePointCollectionUpdate{
- Tags: map[string]*string{
- "key8536": to.Ptr("aaaaaaaaaaaaaaaaaaa"),
- },
- Properties: &armcompute.RestorePointCollectionProperties{
- Source: &armcompute.RestorePointCollectionSourceProperties{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"),
- },
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollections_Update_MinimumSet_Gen.json
-func ExampleRestorePointCollectionsClient_Update_restorePointCollectionsUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", armcompute.RestorePointCollectionUpdate{}, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollections_Delete_MaximumSet_Gen.json
-func ExampleRestorePointCollectionsClient_BeginDelete_restorePointCollectionsDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollections_Delete_MinimumSet_Gen.json
-func ExampleRestorePointCollectionsClient_BeginDelete_restorePointCollectionsDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_Get.json
-func ExampleRestorePointCollectionsClient_Get_getARestorePointCollectionButNotTheRestorePointsContainedInTheRestorePointCollection() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myRpc", &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.json
-func ExampleRestorePointCollectionsClient_Get_getARestorePointCollectionIncludingTheRestorePointsContainedInTheRestorePointCollection() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "rpcName", &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_ListByResourceGroup.json
-func ExampleRestorePointCollectionsClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("myResourceGroup", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePointCollection_ListBySubscription.json
-func ExampleRestorePointCollectionsClient_NewListAllPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointCollectionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListAllPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/restorepoints_client_example_test.go b/sdk/resourcemanager/compute/armcompute/restorepoints_client_example_test.go
deleted file mode 100644
index b6683c10e219..000000000000
--- a/sdk/resourcemanager/compute/armcompute/restorepoints_client_example_test.go
+++ /dev/null
@@ -1,153 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoint_Copy_BetweenRegions.json
-func ExampleRestorePointsClient_BeginCreate_copyARestorePointToADifferentRegion() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreate(ctx, "myResourceGroup", "rpcName", "rpName", armcompute.RestorePoint{
- Properties: &armcompute.RestorePointProperties{
- SourceRestorePoint: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName/restorePoints/sourceRpName"),
- },
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoint_Create.json
-func ExampleRestorePointsClient_BeginCreate_createARestorePoint() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreate(ctx, "myResourceGroup", "rpcName", "rpName", armcompute.RestorePoint{
- Properties: &armcompute.RestorePointProperties{
- ExcludeDisks: []*armcompute.APIEntityReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"),
- }},
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoints_Delete_MaximumSet_Gen.json
-func ExampleRestorePointsClient_BeginDelete_restorePointsDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", "a", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoints_Delete_MinimumSet_Gen.json
-func ExampleRestorePointsClient_BeginDelete_restorePointsDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoint_Get.json
-func ExampleRestorePointsClient_Get_getARestorePoint() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "rpcName", "rpName", &armcompute.RestorePointsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/restorePointExamples/RestorePoint_Get_WithInstanceView.json
-func ExampleRestorePointsClient_Get_getRestorePointWithInstanceView() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewRestorePointsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "rpcName", "rpName", &armcompute.RestorePointsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go
deleted file mode 100644
index d4cd3d8029ca..000000000000
--- a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGallery_List.json
-func ExampleSharedGalleriesClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSharedGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("myLocation", &armcompute.SharedGalleriesClientListOptions{SharedTo: nil})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGallery_Get.json
-func ExampleSharedGalleriesClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSharedGalleriesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myLocation", "galleryUniqueName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go
deleted file mode 100644
index cda97d337cfb..000000000000
--- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImages_List.json
-func ExampleSharedGalleryImagesClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSharedGalleryImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("myLocation", "galleryUniqueName", &armcompute.SharedGalleryImagesClientListOptions{SharedTo: nil})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImage_Get.json
-func ExampleSharedGalleryImagesClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSharedGalleryImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myLocation", "galleryUniqueName", "myGalleryImageName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go
deleted file mode 100644
index c0fc7442b991..000000000000
--- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersions_List.json
-func ExampleSharedGalleryImageVersionsClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSharedGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("myLocation", "galleryUniqueName", "myGalleryImageName", &armcompute.SharedGalleryImageVersionsClientListOptions{SharedTo: nil})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersion_Get.json
-func ExampleSharedGalleryImageVersionsClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSharedGalleryImageVersionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myLocation", "galleryUniqueName", "myGalleryImageName", "myGalleryImageVersionName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go b/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go
deleted file mode 100644
index 86541b102387..000000000000
--- a/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go
+++ /dev/null
@@ -1,362 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json
-func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot1", armcompute.Snapshot{
- Location: to.Ptr("West US"),
- Properties: &armcompute.SnapshotProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
- SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
- StorageAccountID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json
-func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot1", armcompute.Snapshot{
- Location: to.Ptr("West US"),
- Properties: &armcompute.SnapshotProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
- SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json
-func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot2", armcompute.Snapshot{
- Location: to.Ptr("West US"),
- Properties: &armcompute.SnapshotProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyStart),
- SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json
-func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot2", armcompute.Snapshot{
- Location: to.Ptr("West US"),
- Properties: &armcompute.SnapshotProperties{
- CreationData: &armcompute.CreationData{
- CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
- SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.json
-func ExampleSnapshotsClient_BeginUpdate_updateASnapshotWithAcceleratedNetworking() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "mySnapshot", armcompute.SnapshotUpdate{
- Properties: &armcompute.SnapshotUpdateProperties{
- DiskSizeGB: to.Ptr[int32](20),
- SupportedCapabilities: &armcompute.SupportedCapabilities{
- AcceleratedNetwork: to.Ptr(false),
- },
- },
- Tags: map[string]*string{
- "department": to.Ptr("Development"),
- "project": to.Ptr("UpdateSnapshots"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Update.json
-func ExampleSnapshotsClient_BeginUpdate_updateASnapshot() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "mySnapshot", armcompute.SnapshotUpdate{
- Properties: &armcompute.SnapshotUpdateProperties{
- DiskSizeGB: to.Ptr[int32](20),
- },
- Tags: map[string]*string{
- "department": to.Ptr("Development"),
- "project": to.Ptr("UpdateSnapshots"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Get.json
-func ExampleSnapshotsClient_Get_getInformationAboutASnapshot() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "mySnapshot", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_GetIncrementalSnapshot.json
-func ExampleSnapshotsClient_Get_getInformationAboutAnIncrementalSnapshot() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myIncrementalSnapshot", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Delete.json
-func ExampleSnapshotsClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "mySnapshot", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_ListByResourceGroup.json
-func ExampleSnapshotsClient_NewListByResourceGroupPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("myResourceGroup", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_ListBySubscription.json
-func ExampleSnapshotsClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_BeginGetAccess.json
-func ExampleSnapshotsClient_BeginGrantAccess() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginGrantAccess(ctx, "myResourceGroup", "mySnapshot", armcompute.GrantAccessData{
- Access: to.Ptr(armcompute.AccessLevelRead),
- DurationInSeconds: to.Ptr[int32](300),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_EndGetAccess.json
-func ExampleSnapshotsClient_BeginRevokeAccess() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSnapshotsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRevokeAccess(ctx, "myResourceGroup", "mySnapshot", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go
deleted file mode 100644
index df51c6cb141a..000000000000
--- a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go
+++ /dev/null
@@ -1,255 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_ListBySubscription_MaximumSet_Gen.json
-func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeysListBySubscriptionMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListBySubscriptionPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_ListBySubscription_MinimumSet_Gen.json
-func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeysListBySubscriptionMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListBySubscriptionPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_ListByResourceGroup_MaximumSet_Gen.json
-func ExampleSSHPublicKeysClient_NewListByResourceGroupPager_sshPublicKeysListByResourceGroupMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("rgcompute", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_ListByResourceGroup_MinimumSet_Gen.json
-func ExampleSSHPublicKeysClient_NewListByResourceGroupPager_sshPublicKeysListByResourceGroupMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByResourceGroupPager("rgcompute", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKey_Create.json
-func ExampleSSHPublicKeysClient_Create() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Create(ctx, "myResourceGroup", "mySshPublicKeyName", armcompute.SSHPublicKeyResource{
- Location: to.Ptr("westus"),
- Properties: &armcompute.SSHPublicKeyResourceProperties{
- PublicKey: to.Ptr("{ssh-rsa public key}"),
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_Update_MaximumSet_Gen.json
-func ExampleSSHPublicKeysClient_Update_sshPublicKeysUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaaa", armcompute.SSHPublicKeyUpdateResource{
- Tags: map[string]*string{
- "key2854": to.Ptr("a"),
- },
- Properties: &armcompute.SSHPublicKeyResourceProperties{
- PublicKey: to.Ptr("{ssh-rsa public key}"),
- },
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_Update_MinimumSet_Gen.json
-func ExampleSSHPublicKeysClient_Update_sshPublicKeysUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.SSHPublicKeyUpdateResource{}, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_Delete_MaximumSet_Gen.json
-func ExampleSSHPublicKeysClient_Delete_sshPublicKeysDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.Delete(ctx, "rgcompute", "aaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_Delete_MinimumSet_Gen.json
-func ExampleSSHPublicKeysClient_Delete_sshPublicKeysDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.Delete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKey_Get.json
-func ExampleSSHPublicKeysClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "mySshPublicKeyName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/sshPublicKeyExamples/SshPublicKeys_GenerateKeyPair.json
-func ExampleSSHPublicKeysClient_GenerateKeyPair() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewSSHPublicKeysClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GenerateKeyPair(ctx, "myResourceGroup", "mySshPublicKeyName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/usage_client_example_test.go b/sdk/resourcemanager/compute/armcompute/usage_client_example_test.go
deleted file mode 100644
index 10d58bdc3bd0..000000000000
--- a/sdk/resourcemanager/compute/armcompute/usage_client_example_test.go
+++ /dev/null
@@ -1,65 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/Usage_List_MaximumSet_Gen.json
-func ExampleUsageClient_NewListPager_usageListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewUsageClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("4_.", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/Usage_List_MinimumSet_Gen.json
-func ExampleUsageClient_NewListPager_usageListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewUsageClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("_--", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go
deleted file mode 100644
index 418b72b27eeb..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go
+++ /dev/null
@@ -1,138 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_Get_MaximumSet_Gen.json
-func ExampleVirtualMachineExtensionImagesClient_Get_virtualMachineExtensionImagesGetMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_Get_MinimumSet_Gen.json
-func ExampleVirtualMachineExtensionImagesClient_Get_virtualMachineExtensionImagesGetMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", "aaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListTypes_MaximumSet_Gen.json
-func ExampleVirtualMachineExtensionImagesClient_ListTypes_virtualMachineExtensionImagesListTypesMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListTypes(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListTypes_MinimumSet_Gen.json
-func ExampleVirtualMachineExtensionImagesClient_ListTypes_virtualMachineExtensionImagesListTypesMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListTypes(ctx, "aaaa", "aa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListVersions_MaximumSet_Gen.json
-func ExampleVirtualMachineExtensionImagesClient_ListVersions_virtualMachineExtensionImagesListVersionsMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListVersions(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionImagesClientListVersionsOptions{Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"),
- Top: to.Ptr[int32](22),
- Orderby: to.Ptr("a"),
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListVersions_MinimumSet_Gen.json
-func ExampleVirtualMachineExtensionImagesClient_ListVersions_virtualMachineExtensionImagesListVersionsMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListVersions(ctx, "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", &armcompute.VirtualMachineExtensionImagesClientListVersionsOptions{Filter: nil,
- Top: nil,
- Orderby: nil,
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go
deleted file mode 100644
index c7e219420243..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go
+++ /dev/null
@@ -1,263 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "time"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_CreateOrUpdate_MaximumSet_Gen.json
-func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate_virtualMachineExtensionsCreateOrUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaa", armcompute.VirtualMachineExtension{
- Location: to.Ptr("westus"),
- Tags: map[string]*string{
- "key9183": to.Ptr("aa"),
- },
- Properties: &armcompute.VirtualMachineExtensionProperties{
- Type: to.Ptr("extType"),
- AutoUpgradeMinorVersion: to.Ptr(true),
- EnableAutomaticUpgrade: to.Ptr(true),
- ForceUpdateTag: to.Ptr("a"),
- InstanceView: &armcompute.VirtualMachineExtensionInstanceView{
- Name: to.Ptr("aaaaaaaaaaaaaaaaa"),
- Type: to.Ptr("aaaaaaaaa"),
- Statuses: []*armcompute.InstanceViewStatus{
- {
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- }},
- Substatuses: []*armcompute.InstanceViewStatus{
- {
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- }},
- TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"),
- },
- ProtectedSettings: map[string]interface{}{},
- Publisher: to.Ptr("extPublisher"),
- Settings: map[string]interface{}{},
- SuppressFailures: to.Ptr(true),
- TypeHandlerVersion: to.Ptr("1.2"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_CreateOrUpdate_MinimumSet_Gen.json
-func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate_virtualMachineExtensionsCreateOrUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "rgcompute", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineExtension{
- Location: to.Ptr("westus"),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_Update.json
-func ExampleVirtualMachineExtensionsClient_BeginUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myVM", "myVMExtension", armcompute.VirtualMachineExtensionUpdate{
- Properties: &armcompute.VirtualMachineExtensionUpdateProperties{
- Type: to.Ptr("extType"),
- AutoUpgradeMinorVersion: to.Ptr(true),
- ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{
- SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"),
- SourceVault: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"),
- },
- },
- Publisher: to.Ptr("extPublisher"),
- Settings: map[string]interface{}{
- "UserName": "xyz@microsoft.com",
- },
- SuppressFailures: to.Ptr(true),
- TypeHandlerVersion: to.Ptr("1.2"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_Delete_MaximumSet_Gen.json
-func ExampleVirtualMachineExtensionsClient_BeginDelete_virtualMachineExtensionsDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_Delete_MinimumSet_Gen.json
-func ExampleVirtualMachineExtensionsClient_BeginDelete_virtualMachineExtensionsDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_Get_MaximumSet_Gen.json
-func ExampleVirtualMachineExtensionsClient_Get_virtualMachineExtensionsGetMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", &armcompute.VirtualMachineExtensionsClientGetOptions{Expand: to.Ptr("aaaaaa")})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_Get_MinimumSet_Gen.json
-func ExampleVirtualMachineExtensionsClient_Get_virtualMachineExtensionsGetMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_List_MaximumSet_Gen.json
-func ExampleVirtualMachineExtensionsClient_List_virtualMachineExtensionsListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.List(ctx, "rgcompute", "aaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaa")})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachineExtensions_List_MinimumSet_Gen.json
-func ExampleVirtualMachineExtensionsClient_List_virtualMachineExtensionsListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.List(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientListOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go
deleted file mode 100644
index 092cc7f549ab..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go
+++ /dev/null
@@ -1,252 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_Get_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesClient_Get_virtualMachineImagesGetMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "aaaaaa", "aaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_Get_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesClient_Get_virtualMachineImagesGetMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "aaaaaaaaaaaa", "aaaaaaaaaaa", "aa", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_List_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesClient_List_virtualMachineImagesListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.List(ctx, "aaaaaaaaaaaaaaa", "aaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineImagesClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"),
- Top: to.Ptr[int32](18),
- Orderby: to.Ptr("aa"),
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_List_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesClient_List_virtualMachineImagesListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.List(ctx, "aaaaaaa", "aaaaaaaaaaa", "aaaaaaaaaa", "aaaaaa", &armcompute.VirtualMachineImagesClientListOptions{Expand: nil,
- Top: nil,
- Orderby: nil,
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListOffers_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesClient_ListOffers_virtualMachineImagesListOffersMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListOffers(ctx, "aaaaaaa", "aaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListOffers_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesClient_ListOffers_virtualMachineImagesListOffersMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListOffers(ctx, "aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListPublishers_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesClient_ListPublishers_virtualMachineImagesListPublishersMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListPublishers(ctx, "aaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListPublishers_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesClient_ListPublishers_virtualMachineImagesListPublishersMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListPublishers(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListSkus_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesClient_ListSKUs_virtualMachineImagesListSkusMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListSKUs(ctx, "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListSkus_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesClient_ListSKUs_virtualMachineImagesListSkusMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListSKUs(ctx, "aaaa", "aaaaaaaaaaaaa", "aaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesClient_ListByEdgeZone_virtualMachineImagesEdgeZoneListByEdgeZoneMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("5ece5940-d962-4dad-a98f-ca9ac0f021a5", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListByEdgeZone(ctx, "WestUS", "microsoftlosangeles1", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesClient_ListByEdgeZone_virtualMachineImagesEdgeZoneListByEdgeZoneMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesClient("5ece5940-d962-4dad-a98f-ca9ac0f021a5", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListByEdgeZone(ctx, "WestUS", "microsoftlosangeles1", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go
deleted file mode 100644
index 63713fa3e100..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go
+++ /dev/null
@@ -1,214 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesEdgeZoneClient_Get_virtualMachineImagesEdgeZoneGetMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesEdgeZoneClient_Get_virtualMachineImagesEdgeZoneGetMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesEdgeZoneClient_List_virtualMachineImagesEdgeZoneListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.List(ctx, "aaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineImagesEdgeZoneClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"),
- Top: to.Ptr[int32](12),
- Orderby: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesEdgeZoneClient_List_virtualMachineImagesEdgeZoneListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.List(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaa", "aaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineImagesEdgeZoneClientListOptions{Expand: nil,
- Top: nil,
- Orderby: nil,
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesEdgeZoneClient_ListOffers_virtualMachineImagesEdgeZoneListOffersMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListOffers(ctx, "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesEdgeZoneClient_ListOffers_virtualMachineImagesEdgeZoneListOffersMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListOffers(ctx, "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesEdgeZoneClient_ListPublishers_virtualMachineImagesEdgeZoneListPublishersMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListPublishers(ctx, "aaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesEdgeZoneClient_ListPublishers_virtualMachineImagesEdgeZoneListPublishersMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListPublishers(ctx, "aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.json
-func ExampleVirtualMachineImagesEdgeZoneClient_ListSKUs_virtualMachineImagesEdgeZoneListSkusMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListSKUs(ctx, "aaaaaaaaaaaa", "aaaaa", "aaaaaaaaaaaa", "aaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.json
-func ExampleVirtualMachineImagesEdgeZoneClient_ListSKUs_virtualMachineImagesEdgeZoneListSkusMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineImagesEdgeZoneClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ListSKUs(ctx, "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaa", "aaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go
deleted file mode 100644
index 27bf1aad37d5..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go
+++ /dev/null
@@ -1,197 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/RunCommand_List.json
-func ExampleVirtualMachineRunCommandsClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineRunCommandsClient("subid", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("SoutheastAsia", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/RunCommand_Get.json
-func ExampleVirtualMachineRunCommandsClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineRunCommandsClient("24fb23e3-6ba3-41f0-9b6e-e41131d5d61e", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "SoutheastAsia", "RunPowerShellScript", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.json
-func ExampleVirtualMachineRunCommandsClient_BeginCreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineRunCommandsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", "myRunCommand", armcompute.VirtualMachineRunCommand{
- Location: to.Ptr("West US"),
- Properties: &armcompute.VirtualMachineRunCommandProperties{
- AsyncExecution: to.Ptr(false),
- Parameters: []*armcompute.RunCommandInputParameter{
- {
- Name: to.Ptr("param1"),
- Value: to.Ptr("value1"),
- },
- {
- Name: to.Ptr("param2"),
- Value: to.Ptr("value2"),
- }},
- RunAsPassword: to.Ptr(""),
- RunAsUser: to.Ptr("user1"),
- Source: &armcompute.VirtualMachineRunCommandScriptSource{
- Script: to.Ptr("Write-Host Hello World!"),
- },
- TimeoutInSeconds: to.Ptr[int32](3600),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand_Update.json
-func ExampleVirtualMachineRunCommandsClient_BeginUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineRunCommandsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myVM", "myRunCommand", armcompute.VirtualMachineRunCommandUpdate{
- Properties: &armcompute.VirtualMachineRunCommandProperties{
- Source: &armcompute.VirtualMachineRunCommandScriptSource{
- Script: to.Ptr("Write-Host Script Source Updated!"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand_Delete.json
-func ExampleVirtualMachineRunCommandsClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineRunCommandsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myVM", "myRunCommand", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand_Get.json
-func ExampleVirtualMachineRunCommandsClient_GetByVirtualMachine() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineRunCommandsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetByVirtualMachine(ctx, "myResourceGroup", "myVM", "myRunCommand", &armcompute.VirtualMachineRunCommandsClientGetByVirtualMachineOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand_List.json
-func ExampleVirtualMachineRunCommandsClient_NewListByVirtualMachinePager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineRunCommandsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByVirtualMachinePager("myResourceGroup", "myVM", &armcompute.VirtualMachineRunCommandsClientListByVirtualMachineOptions{Expand: nil})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go
deleted file mode 100644
index 5fd00ec91245..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go
+++ /dev/null
@@ -1,3857 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "time"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ListBySubscription_ByLocation.json
-func ExampleVirtualMachinesClient_NewListByLocationPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscriptionId}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByLocationPager("eastus", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Capture_MaximumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginCapture_virtualMachinesCaptureMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCapture(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineCaptureParameters{
- DestinationContainerName: to.Ptr("aaaaaaa"),
- OverwriteVhds: to.Ptr(true),
- VhdPrefix: to.Ptr("aaaaaaaaa"),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Capture_MinimumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginCapture_virtualMachinesCaptureMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCapture(ctx, "rgcompute", "aaaaaaaaaaaaa", armcompute.VirtualMachineCaptureParameters{
- DestinationContainerName: to.Ptr("aaaaaaa"),
- OverwriteVhds: to.Ptr(true),
- VhdPrefix: to.Ptr("aaaaaaaaa"),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingAssessmentModeOfImageDefault() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- LinuxConfiguration: &armcompute.LinuxConfiguration{
- PatchSettings: &armcompute.LinuxPatchSettings{
- AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault),
- },
- ProvisionVMAgent: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("UbuntuServer"),
- Publisher: to.Ptr("Canonical"),
- SKU: to.Ptr("16.04-LTS"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndAutomaticByPlatformSettings() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- LinuxConfiguration: &armcompute.LinuxConfiguration{
- PatchSettings: &armcompute.LinuxPatchSettings{
- AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeAutomaticByPlatform),
- AutomaticByPlatformSettings: &armcompute.LinuxVMGuestPatchAutomaticByPlatformSettings{
- RebootSetting: to.Ptr(armcompute.LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever),
- },
- PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeAutomaticByPlatform),
- },
- ProvisionVMAgent: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("UbuntuServer"),
- Publisher: to.Ptr("Canonical"),
- SKU: to.Ptr("16.04-LTS"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingPatchModeOfImageDefault() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- LinuxConfiguration: &armcompute.LinuxConfiguration{
- PatchSettings: &armcompute.LinuxPatchSettings{
- PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault),
- },
- ProvisionVMAgent: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("UbuntuServer"),
- Publisher: to.Ptr("Canonical"),
- SKU: to.Ptr("16.04-LTS"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- LinuxConfiguration: &armcompute.LinuxConfiguration{
- PatchSettings: &armcompute.LinuxPatchSettings{
- AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeAutomaticByPlatform),
- PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeAutomaticByPlatform),
- },
- ProvisionVMAgent: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("UbuntuServer"),
- Publisher: to.Ptr("Canonical"),
- SKU: to.Ptr("16.04-LTS"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromACommunityGalleryImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- CommunityGalleryImageID: to.Ptr("/CommunityGalleries/galleryPublicName/Images/communityGalleryImageName/Versions/communityGalleryImageVersionName"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromASharedGalleryImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- SharedGalleryImageID: to.Ptr("/SharedGalleries/sharedGalleryName/Images/sharedGalleryImageName/Versions/sharedGalleryImageVersionName"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithDiskControllerType() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD4V3),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- DiskControllerType: to.Ptr(armcompute.DiskControllerTypesNVMe),
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- UserData: to.Ptr("U29tZSBDdXN0b20gRGF0YQ=="),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithHibernationEnabled() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{
- Location: to.Ptr("eastus2euap"),
- Properties: &armcompute.VirtualMachineProperties{
- AdditionalCapabilities: &armcompute.AdditionalCapabilities{
- HibernationEnabled: to.Ptr(true),
- },
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("{vm-name}"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2019-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("vmOSdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithUefiSettingsOfSecureBootAndVTpm() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- SecurityProfile: &armcompute.SecurityProfile{
- SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch),
- UefiSettings: &armcompute.UefiSettings{
- SecureBootEnabled: to.Ptr(true),
- VTpmEnabled: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windowsserver-gen2preview-preview"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("windows10-tvm"),
- Version: to.Ptr("18363.592.2001092016"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithUserData.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithUserData() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("{vm-name}"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("vmOSdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_CreateWithVMSizeProperties.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithVmSizeProperties() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD4V3),
- VMSizeProperties: &armcompute.VMSizeProperties{
- VCPUsAvailable: to.Ptr[int32](1),
- VCPUsPerCore: to.Ptr[int32](1),
- },
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- UserData: to.Ptr("U29tZSBDdXN0b20gRGF0YQ=="),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithNetworkInterfaceConfiguration() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101),
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{
- {
- Name: to.Ptr("{nic-config-name}"),
- Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{
- DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete),
- IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{
- {
- Name: to.Ptr("{ip-config-name}"),
- Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{
- Primary: to.Ptr(true),
- PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{
- Name: to.Ptr("{publicIP-config-name}"),
- Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{
- DeleteOption: to.Ptr(armcompute.DeleteOptionsDetach),
- PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodStatic),
- },
- SKU: &armcompute.PublicIPAddressSKU{
- Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic),
- Tier: to.Ptr(armcompute.PublicIPAddressSKUTierGlobal),
- },
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithSecurityTypeConfidentialVmWithCustomerManagedKeys() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypes("Standard_DC2as_v5")),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- SecurityProfile: &armcompute.SecurityProfile{
- SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM),
- UefiSettings: &armcompute.UefiSettings{
- SecureBootEnabled: to.Ptr(true),
- VTpmEnabled: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("2019-datacenter-cvm"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("windows-cvm"),
- Version: to.Ptr("17763.2183.2109130127"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- SecurityProfile: &armcompute.VMDiskSecurityProfile{
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
- },
- SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesDiskWithVMGuestState),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithSecurityTypeConfidentialVmWithPlatformManagedKeys() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypes("Standard_DC2as_v5")),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- SecurityProfile: &armcompute.SecurityProfile{
- SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM),
- UefiSettings: &armcompute.UefiSettings{
- SecureBootEnabled: to.Ptr(true),
- VTpmEnabled: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("2019-datacenter-cvm"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("windows-cvm"),
- Version: to.Ptr("17763.2183.2109130127"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- SecurityProfile: &armcompute.VMDiskSecurityProfile{
- SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesDiskWithVMGuestState),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingAssessmentModeOfImageDefault() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- WindowsConfiguration: &armcompute.WindowsConfiguration{
- EnableAutomaticUpdates: to.Ptr(true),
- PatchSettings: &armcompute.PatchSettings{
- AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault),
- },
- ProvisionVMAgent: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByOs() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- WindowsConfiguration: &armcompute.WindowsConfiguration{
- EnableAutomaticUpdates: to.Ptr(true),
- PatchSettings: &armcompute.PatchSettings{
- PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByOS),
- },
- ProvisionVMAgent: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndAutomaticByPlatformSettings() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- WindowsConfiguration: &armcompute.WindowsConfiguration{
- EnableAutomaticUpdates: to.Ptr(true),
- PatchSettings: &armcompute.PatchSettings{
- AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform),
- AutomaticByPlatformSettings: &armcompute.WindowsVMGuestPatchAutomaticByPlatformSettings{
- RebootSetting: to.Ptr(armcompute.WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever),
- },
- PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform),
- },
- ProvisionVMAgent: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndEnableHotpatchingSetToTrue() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- WindowsConfiguration: &armcompute.WindowsConfiguration{
- EnableAutomaticUpdates: to.Ptr(true),
- PatchSettings: &armcompute.PatchSettings{
- EnableHotpatching: to.Ptr(true),
- PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform),
- },
- ProvisionVMAgent: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfManual() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- WindowsConfiguration: &armcompute.WindowsConfiguration{
- EnableAutomaticUpdates: to.Ptr(true),
- PatchSettings: &armcompute.PatchSettings{
- PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual),
- },
- ProvisionVMAgent: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- WindowsConfiguration: &armcompute.WindowsConfiguration{
- EnableAutomaticUpdates: to.Ptr(true),
- PatchSettings: &armcompute.PatchSettings{
- AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform),
- PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform),
- },
- ProvisionVMAgent: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createACustomImageVmFromAnUnmanagedGeneralizedOsImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- Image: &armcompute.VirtualHardDisk{
- URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd"),
- },
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- Vhd: &armcompute.VirtualHardDisk{
- URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAPlatformImageVmWithUnmanagedOsAndDataDisks() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- DataDisks: []*armcompute.DataDisk{
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](0),
- Vhd: &armcompute.VirtualHardDisk{
- URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd"),
- },
- },
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](1),
- Vhd: &armcompute.VirtualHardDisk{
- URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd"),
- },
- }},
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- Vhd: &armcompute.VirtualHardDisk{
- URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromACustomImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromAGeneralizedSharedImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromASpecializedSharedImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMacine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmInAVirtualMachineScaleSetWithCustomerAssignedPlatformFaultDomain() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- PlatformFaultDomain: to.Ptr[int32](1),
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- VirtualMachineScaleSet: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{existing-flex-vmss-name-with-platformFaultDomainCount-greater-than-1}"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmInAnAvailabilitySet() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- AvailabilitySet: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}"),
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithApplicationProfile() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- ApplicationProfile: &armcompute.ApplicationProfile{
- GalleryApplications: []*armcompute.VMGalleryApplication{
- {
- ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"),
- EnableAutomaticUpgrade: to.Ptr(false),
- Order: to.Ptr[int32](1),
- PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"),
- Tags: to.Ptr("myTag1"),
- TreatFailureAsDeploymentFailure: to.Ptr(false),
- },
- {
- PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"),
- }},
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("{image_offer}"),
- Publisher: to.Ptr("{image_publisher}"),
- SKU: to.Ptr("{image_sku}"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithDiskEncryptionSetResourceIdInTheOsDiskAndDataDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- DataDisks: []*armcompute.DataDisk{
- {
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](0),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- {
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](1),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}"),
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- }},
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithHostEncryptionUsingEncryptionAtHostProperty() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- SecurityProfile: &armcompute.SecurityProfile{
- EncryptionAtHost: to.Ptr(true),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- SKU: to.Ptr("windows2016"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithScheduledEventsProfile() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{
- TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{
- Enable: to.Ptr(true),
- NotBeforeTimeout: to.Ptr("PT10M"),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithAMarketplaceImagePlan() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- SKU: to.Ptr("windows2016"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithAnExtensionsTimeBudget() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- ExtensionsTimeBudget: to.Ptr("PT30M"),
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMacine_Create_WithBootDiagnostics.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithBootDiagnostics() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEmptyDataDisks() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- DataDisks: []*armcompute.DataDisk{
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](0),
- },
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](1),
- }},
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEphemeralOsDiskProvisioningInCacheDiskUsingPlacementProperty() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- SKU: to.Ptr("windows2016"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- DiffDiskSettings: &armcompute.DiffDiskSettings{
- Option: to.Ptr(armcompute.DiffDiskOptionsLocal),
- Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk),
- },
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEphemeralOsDiskProvisioningInResourceDiskUsingPlacementProperty() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- SKU: to.Ptr("windows2016"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- DiffDiskSettings: &armcompute.DiffDiskSettings{
- Option: to.Ptr(armcompute.DiffDiskOptionsLocal),
- Placement: to.Ptr(armcompute.DiffDiskPlacementResourceDisk),
- },
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEphemeralOsDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- SKU: to.Ptr("windows2016"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- DiffDiskSettings: &armcompute.DiffDiskSettings{
- Option: to.Ptr(armcompute.DiffDiskOptionsLocal),
- },
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithManagedBootDiagnostics() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- },
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithPasswordAuthentication() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithPremiumStorage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithSshAuthentication() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- LinuxConfiguration: &armcompute.LinuxConfiguration{
- DisablePasswordAuthentication: to.Ptr(true),
- SSH: &armcompute.SSHConfiguration{
- PublicKeys: []*armcompute.SSHPublicKey{
- {
- Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"),
- KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"),
- }},
- },
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("{image_offer}"),
- Publisher: to.Ptr("{image_publisher}"),
- SKU: to.Ptr("{image_sku}"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.json
-func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createOrUpdateAVmWithCapacityReservation() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{
- Location: to.Ptr("westus"),
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineProperties{
- CapacityReservation: &armcompute.CapacityReservationProfile{
- CapacityReservationGroup: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"),
- },
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- SKU: to.Ptr("windows2016"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.json
-func ExampleVirtualMachinesClient_BeginUpdate_updateAVmByDetachingDataDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachineUpdate{
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- DataDisks: []*armcompute.DataDisk{
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](0),
- ToBeDetached: to.Ptr(true),
- },
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](1),
- ToBeDetached: to.Ptr(false),
- }},
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.json
-func ExampleVirtualMachinesClient_BeginUpdate_updateAVmByForceDetachingDataDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachineUpdate{
- Properties: &armcompute.VirtualMachineProperties{
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2),
- },
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerName: to.Ptr("myVM"),
- },
- StorageProfile: &armcompute.StorageProfile{
- DataDisks: []*armcompute.DataDisk{
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](0),
- ToBeDetached: to.Ptr(true),
- },
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](1),
- ToBeDetached: to.Ptr(false),
- }},
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("myVMosdisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Delete_Force.json
-func ExampleVirtualMachinesClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get.json
-func ExampleVirtualMachinesClient_Get_getAVirtualMachine() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.json
-func ExampleVirtualMachinesClient_Get_getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.json
-func ExampleVirtualMachinesClient_Get_getAVirtualMachineWithDiskControllerTypeProperties() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.json
-func ExampleVirtualMachinesClient_Get_getAVirtualMachineWithVmSizeProperties() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get_InstanceView.json
-func ExampleVirtualMachinesClient_InstanceView_getVirtualMachineInstanceView() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.InstanceView(ctx, "myResourceGroup", "myVM", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json
-func ExampleVirtualMachinesClient_InstanceView_getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.InstanceView(ctx, "myResourceGroup", "myVM", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ConvertToManagedDisks_MaximumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginConvertToManagedDisks_virtualMachinesConvertToManagedDisksMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginConvertToManagedDisks(ctx, "rgcompute", "aaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ConvertToManagedDisks_MinimumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginConvertToManagedDisks_virtualMachinesConvertToManagedDisksMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginConvertToManagedDisks(ctx, "rgcompute", "aaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Deallocate_MaximumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginDeallocate_virtualMachinesDeallocateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaa", &armcompute.VirtualMachinesClientBeginDeallocateOptions{Hibernate: to.Ptr(true)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Deallocate_MinimumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginDeallocate_virtualMachinesDeallocateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", &armcompute.VirtualMachinesClientBeginDeallocateOptions{Hibernate: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Generalize.json
-func ExampleVirtualMachinesClient_Generalize() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.Generalize(ctx, "myResourceGroup", "myVMName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_List_MaximumSet_Gen.json
-func ExampleVirtualMachinesClient_NewListPager_virtualMachinesListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("rgcompute", &armcompute.VirtualMachinesClientListOptions{Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa")})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_List_MinimumSet_Gen.json
-func ExampleVirtualMachinesClient_NewListPager_virtualMachinesListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("rgcompute", &armcompute.VirtualMachinesClientListOptions{Filter: nil})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ListAll_MaximumSet_Gen.json
-func ExampleVirtualMachinesClient_NewListAllPager_virtualMachinesListAllMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: to.Ptr("aaaaaa"),
- Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
- })
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ListAll_MinimumSet_Gen.json
-func ExampleVirtualMachinesClient_NewListAllPager_virtualMachinesListAllMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: nil,
- Filter: nil,
- })
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_ListAvailableVmSizes.json
-func ExampleVirtualMachinesClient_NewListAvailableSizesPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListAvailableSizesPager("myResourceGroup", "myVmName", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_PowerOff_MaximumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginPowerOff_virtualMachinesPowerOffMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachinesClientBeginPowerOffOptions{SkipShutdown: to.Ptr(true)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_PowerOff_MinimumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginPowerOff_virtualMachinesPowerOffMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachinesClientBeginPowerOffOptions{SkipShutdown: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Reapply.json
-func ExampleVirtualMachinesClient_BeginReapply() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReapply(ctx, "ResourceGroup", "VMName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Restart_MaximumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginRestart_virtualMachinesRestartMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRestart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Restart_MinimumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginRestart_virtualMachinesRestartMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRestart(ctx, "rgcompute", "aaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Start_MaximumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginStart_virtualMachinesStartMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Start_MinimumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginStart_virtualMachinesStartMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginStart(ctx, "rgcompute", "aaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Redeploy_MaximumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginRedeploy_virtualMachinesRedeployMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRedeploy(ctx, "rgcompute", "a", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_Redeploy_MinimumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginRedeploy_virtualMachinesRedeployMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_Reimage.json
-func ExampleVirtualMachinesClient_BeginReimage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimage(ctx, "myResourceGroup", "myVMName", &armcompute.VirtualMachinesClientBeginReimageOptions{Parameters: &armcompute.VirtualMachineReimageParameters{
- TempDisk: to.Ptr(true),
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.json
-func ExampleVirtualMachinesClient_RetrieveBootDiagnosticsData() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.RetrieveBootDiagnosticsData(ctx, "ResourceGroup", "VMName", &armcompute.VirtualMachinesClientRetrieveBootDiagnosticsDataOptions{SasURIExpirationTimeInMinutes: to.Ptr[int32](60)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_PerformMaintenance_MaximumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginPerformMaintenance_virtualMachinesPerformMaintenanceMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachines_PerformMaintenance_MinimumSet_Gen.json
-func ExampleVirtualMachinesClient_BeginPerformMaintenance_virtualMachinesPerformMaintenanceMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_SimulateEviction.json
-func ExampleVirtualMachinesClient_SimulateEviction() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.SimulateEviction(ctx, "ResourceGroup", "VMName", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_AssessPatches.json
-func ExampleVirtualMachinesClient_BeginAssessPatches() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginAssessPatches(ctx, "myResourceGroupName", "myVMName", 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineExamples/VirtualMachine_InstallPatches.json
-func ExampleVirtualMachinesClient_BeginInstallPatches() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginInstallPatches(ctx, "myResourceGroupName", "myVMName", armcompute.VirtualMachineInstallPatchesParameters{
- MaximumDuration: to.Ptr("PT4H"),
- RebootSetting: to.Ptr(armcompute.VMGuestPatchRebootSettingIfRequired),
- WindowsParameters: &armcompute.WindowsParameters{
- ClassificationsToInclude: []*armcompute.VMGuestPatchClassificationWindows{
- to.Ptr(armcompute.VMGuestPatchClassificationWindowsCritical),
- to.Ptr(armcompute.VMGuestPatchClassificationWindowsSecurity)},
- MaxPatchPublishDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-19T02:36:43.0539904+00:00"); return t }()),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineRunCommand.json
-func ExampleVirtualMachinesClient_BeginRunCommand() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachinesClient("24fb23e3-6ba3-41f0-9b6e-e41131d5d61e", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRunCommand(ctx, "crptestar98131", "vm3036", armcompute.RunCommandInput{
- CommandID: to.Ptr("RunPowerShellScript"),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go
deleted file mode 100644
index a00e0cf6eef1..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go
+++ /dev/null
@@ -1,267 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_CreateOrUpdate_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetExtensionsClient_BeginCreateOrUpdate_virtualMachineScaleSetExtensionsCreateOrUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "rgcompute", "aaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetExtension{
- Name: to.Ptr("{extension-name}"),
- Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{
- Type: to.Ptr("{extension-Type}"),
- AutoUpgradeMinorVersion: to.Ptr(true),
- EnableAutomaticUpgrade: to.Ptr(true),
- ForceUpdateTag: to.Ptr("aaaaaaaaa"),
- ProtectedSettings: map[string]interface{}{},
- ProvisionAfterExtensions: []*string{
- to.Ptr("aa")},
- Publisher: to.Ptr("{extension-Publisher}"),
- Settings: map[string]interface{}{},
- SuppressFailures: to.Ptr(true),
- TypeHandlerVersion: to.Ptr("{handler-version}"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_CreateOrUpdate_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetExtensionsClient_BeginCreateOrUpdate_virtualMachineScaleSetExtensionsCreateOrUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "rgcompute", "aaaaaaaaaaa", "aaaaaaaaaaa", armcompute.VirtualMachineScaleSetExtension{}, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Update_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetExtensionsClient_BeginUpdate_virtualMachineScaleSetExtensionsUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", armcompute.VirtualMachineScaleSetExtensionUpdate{
- Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{
- Type: to.Ptr("{extension-Type}"),
- AutoUpgradeMinorVersion: to.Ptr(true),
- EnableAutomaticUpgrade: to.Ptr(true),
- ForceUpdateTag: to.Ptr("aaaaaaaaa"),
- ProtectedSettings: map[string]interface{}{},
- ProvisionAfterExtensions: []*string{
- to.Ptr("aa")},
- Publisher: to.Ptr("{extension-Publisher}"),
- Settings: map[string]interface{}{},
- SuppressFailures: to.Ptr(true),
- TypeHandlerVersion: to.Ptr("{handler-version}"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Update_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetExtensionsClient_BeginUpdate_virtualMachineScaleSetExtensionsUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", armcompute.VirtualMachineScaleSetExtensionUpdate{}, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Delete_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetExtensionsClient_BeginDelete_virtualMachineScaleSetExtensionsDeleteMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Delete_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetExtensionsClient_BeginDelete_virtualMachineScaleSetExtensionsDeleteMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "rgcompute", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Get_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetExtensionsClient_Get_virtualMachineScaleSetExtensionsGetMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetExtensionsClientGetOptions{Expand: to.Ptr("aaaaaaa")})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Get_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetExtensionsClient_Get_virtualMachineScaleSetExtensionsGetMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetExtensionsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_List_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetExtensionsClient_NewListPager_virtualMachineScaleSetExtensionsListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_List_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetExtensionsClient_NewListPager_virtualMachineScaleSetExtensionsListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client_example_test.go
deleted file mode 100644
index 95c2e88ff9a9..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client_example_test.go
+++ /dev/null
@@ -1,160 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_Cancel_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginCancel_virtualMachineScaleSetRollingUpgradesCancelMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCancel(ctx, "rgcompute", "aaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_Cancel_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginCancel_virtualMachineScaleSetRollingUpgradesCancelMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCancel(ctx, "rgcompute", "aaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartOSUpgrade_virtualMachineScaleSetRollingUpgradesStartOsUpgradeMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginStartOSUpgrade(ctx, "rgcompute", "aaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartOSUpgrade_virtualMachineScaleSetRollingUpgradesStartOsUpgradeMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginStartOSUpgrade(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.json
-func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartExtensionUpgrade() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginStartExtensionUpgrade(ctx, "myResourceGroup", "{vmss-name}", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_GetLatest_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetRollingUpgradesClient_GetLatest_virtualMachineScaleSetRollingUpgradesGetLatestMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetLatest(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_GetLatest_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetRollingUpgradesClient_GetLatest_virtualMachineScaleSetRollingUpgradesGetLatestMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetRollingUpgradesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetLatest(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go
deleted file mode 100644
index ce67ef4c63f4..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go
+++ /dev/null
@@ -1,4323 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListBySubscription_ByLocation.json
-func ExampleVirtualMachineScaleSetsClient_NewListByLocationPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListByLocationPager("eastus", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAVmssWithAnExtensionThatHasSuppressFailuresEnabled() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{
- Extensions: []*armcompute.VirtualMachineScaleSetExtension{
- {
- Name: to.Ptr("{extension-name}"),
- Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{
- Type: to.Ptr("{extension-Type}"),
- AutoUpgradeMinorVersion: to.Ptr(false),
- Publisher: to.Ptr("{extension-Publisher}"),
- Settings: map[string]interface{}{},
- SuppressFailures: to.Ptr(true),
- TypeHandlerVersion: to.Ptr("{handler-version}"),
- },
- }},
- },
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAVmssWithAnExtensionWithProtectedSettingsFromKeyVault() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{
- Extensions: []*armcompute.VirtualMachineScaleSetExtension{
- {
- Name: to.Ptr("{extension-name}"),
- Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{
- Type: to.Ptr("{extension-Type}"),
- AutoUpgradeMinorVersion: to.Ptr(false),
- ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{
- SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"),
- SourceVault: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"),
- },
- },
- Publisher: to.Ptr("{extension-Publisher}"),
- Settings: map[string]interface{}{},
- TypeHandlerVersion: to.Ptr("{handler-version}"),
- },
- }},
- },
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Name: to.Ptr("osDisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- Image: &armcompute.VirtualHardDisk{
- URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd"),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAPlatformImageScaleSetWithUnmanagedOsDisks() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Name: to.Ptr("osDisk"),
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- VhdContainers: []*string{
- to.Ptr("http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer"),
- to.Ptr("http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer"),
- to.Ptr("http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer"),
- to.Ptr("http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer"),
- to.Ptr("http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer")},
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetFromACustomImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetFromAGeneralizedSharedImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetFromASpecializedSharedImage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWhereNicConfigHasDisableTcpStateTrackingProperty() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{nicConfig1-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- DisableTCPStateTracking: to.Ptr(true),
- EnableAcceleratedNetworking: to.Ptr(true),
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- },
- {
- Name: to.Ptr("{nicConfig2-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- DisableTCPStateTracking: to.Ptr(false),
- EnableAcceleratedNetworking: to.Ptr(false),
- EnableIPForwarding: to.Ptr(false),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{nicConfig2-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Primary: to.Ptr(true),
- PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4),
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name2}"),
- },
- },
- }},
- Primary: to.Ptr(false),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithApplicationProfile() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- ApplicationProfile: &armcompute.ApplicationProfile{
- GalleryApplications: []*armcompute.VMGalleryApplication{
- {
- ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"),
- EnableAutomaticUpgrade: to.Ptr(false),
- Order: to.Ptr[int32](1),
- PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"),
- Tags: to.Ptr("myTag1"),
- TreatFailureAsDeploymentFailure: to.Ptr(true),
- },
- {
- PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"),
- }},
- },
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithDiskControllerType() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- HardwareProfile: &armcompute.VirtualMachineScaleSetHardwareProfile{
- VMSizeProperties: &armcompute.VMSizeProperties{
- VCPUsAvailable: to.Ptr[int32](1),
- VCPUsPerCore: to.Ptr[int32](1),
- },
- },
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- DiskControllerType: to.Ptr("NVMe"),
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="),
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithDiskEncryptionSetResourceInOsDiskAndDataDisk() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{
- {
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](0),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- }},
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_DS1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithFpgaNetworkInterfaces() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- },
- {
- Name: to.Ptr("{fpgaNic-Name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableAcceleratedNetworking: to.Ptr(false),
- EnableFpga: to.Ptr(true),
- EnableIPForwarding: to.Ptr(false),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{fpgaNic-Name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Primary: to.Ptr(true),
- PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4),
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(false),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- SecurityProfile: &armcompute.SecurityProfile{
- EncryptionAtHost: to.Ptr(true),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- SKU: to.Ptr("windows2016"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_DS1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSecurityTypeAsConfidentialVm() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- SecurityProfile: &armcompute.SecurityProfile{
- SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM),
- UefiSettings: &armcompute.UefiSettings{
- SecureBootEnabled: to.Ptr(true),
- VTpmEnabled: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("2019-datacenter-cvm"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("windows-cvm"),
- Version: to.Ptr("17763.2183.2109130127"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- SecurityProfile: &armcompute.VMDiskSecurityProfile{
- SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_DC2as_v5"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithUefiSettingsOfSecureBootAndVTpm() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- SecurityProfile: &armcompute.SecurityProfile{
- SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch),
- UefiSettings: &armcompute.UefiSettings{
- SecureBootEnabled: to.Ptr(true),
- VTpmEnabled: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windowsserver-gen2preview-preview"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("windows10-tvm"),
- Version: to.Ptr("18363.592.2001092016"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D2s_v3"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAMarketplaceImagePlan() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- SKU: to.Ptr("windows2016"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAnAzureApplicationGateway() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}"),
- }},
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAnAzureLoadBalancer() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- LoadBalancerBackendAddressPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}"),
- }},
- LoadBalancerInboundNatPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}"),
- }},
- PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{
- PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4),
- },
- },
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAutomaticRepairsEnabled() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{
- Enabled: to.Ptr(true),
- GracePeriod: to.Ptr("PT10M"),
- },
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithBootDiagnostics() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithEmptyDataDisksOnEachVm() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](0),
- },
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](1),
- }},
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- DiskSizeGB: to.Ptr[int32](512),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D2_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithEphemeralOsDisksUsingPlacementProperty() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- SKU: to.Ptr("windows2016"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- DiffDiskSettings: &armcompute.DiffDiskSettings{
- Option: to.Ptr(armcompute.DiffDiskOptionsLocal),
- Placement: to.Ptr(armcompute.DiffDiskPlacementResourceDisk),
- },
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_DS1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithEphemeralOsDisks() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("windows-data-science-vm"),
- Publisher: to.Ptr("microsoft-ads"),
- SKU: to.Ptr("windows2016"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadOnly),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- DiffDiskSettings: &armcompute.DiffDiskSettings{
- Option: to.Ptr(armcompute.DiffDiskOptionsLocal),
- },
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_DS1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithExtensionTimeBudget() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{
- ExtensionsTimeBudget: to.Ptr("PT1H20M"),
- Extensions: []*armcompute.VirtualMachineScaleSetExtension{
- {
- Name: to.Ptr("{extension-name}"),
- Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{
- Type: to.Ptr("{extension-Type}"),
- AutoUpgradeMinorVersion: to.Ptr(false),
- Publisher: to.Ptr("{extension-Publisher}"),
- Settings: map[string]interface{}{},
- TypeHandlerVersion: to.Ptr("{handler-version}"),
- },
- }},
- },
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithManagedBootDiagnostics() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- },
- },
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithPasswordAuthentication() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithPremiumStorage() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithPriorityMixPolicy() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- OrchestrationMode: to.Ptr(armcompute.OrchestrationModeFlexible),
- PriorityMixPolicy: &armcompute.PriorityMixPolicy{
- BaseRegularPriorityCount: to.Ptr[int32](4),
- RegularPriorityPercentageAboveBase: to.Ptr[int32](50),
- },
- SinglePlacementGroup: to.Ptr(false),
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- BillingProfile: &armcompute.BillingProfile{
- MaxPrice: to.Ptr[float64](-1),
- },
- EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate),
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesSpot),
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_A8m_v2"),
- Capacity: to.Ptr[int64](10),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithScaleInPolicy() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- ScaleInPolicy: &armcompute.ScaleInPolicy{
- ForceDeletion: to.Ptr(true),
- Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{
- to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesOldestVM)},
- },
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSpotRestorePolicy() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- SpotRestorePolicy: &armcompute.SpotRestorePolicy{
- Enabled: to.Ptr(true),
- RestoreTimeout: to.Ptr("PT1H"),
- },
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- BillingProfile: &armcompute.BillingProfile{
- MaxPrice: to.Ptr[float64](-1),
- },
- EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate),
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesSpot),
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_A8m_v2"),
- Capacity: to.Ptr[int64](2),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSshAuthentication() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- LinuxConfiguration: &armcompute.LinuxConfiguration{
- DisablePasswordAuthentication: to.Ptr(true),
- SSH: &armcompute.SSHConfiguration{
- PublicKeys: []*armcompute.SSHPublicKey{
- {
- Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"),
- KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"),
- }},
- },
- },
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithTerminateScheduledEventsEnabled() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{
- TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{
- Enable: to.Ptr(true),
- NotBeforeTimeout: to.Ptr("PT5M"),
- },
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithUserData() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="),
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithVirtualMachinesInDifferentZones() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("centralus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeAutomatic),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](0),
- },
- {
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](1),
- }},
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- DiskSizeGB: to.Ptr[int32](512),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_A1_v2"),
- Capacity: to.Ptr[int64](2),
- Tier: to.Ptr("Standard"),
- },
- Zones: []*string{
- to.Ptr("1"),
- to.Ptr("3")},
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithVmSizeProperties() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- HardwareProfile: &armcompute.VirtualMachineScaleSetHardwareProfile{
- VMSizeProperties: &armcompute.VMSizeProperties{
- VCPUsAvailable: to.Ptr[int32](1),
- VCPUsPerCore: to.Ptr[int32](1),
- },
- },
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="),
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_D1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.json
-func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createOrUpdateAScaleSetWithCapacityReservation() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{
- Location: to.Ptr("westus"),
- Properties: &armcompute.VirtualMachineScaleSetProperties{
- Overprovision: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
- CapacityReservation: &armcompute.CapacityReservationProfile{
- CapacityReservationGroup: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"),
- },
- },
- NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- Name: to.Ptr("{vmss-name}"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"),
- },
- },
- }},
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{
- AdminPassword: to.Ptr("{your-password}"),
- AdminUsername: to.Ptr("{your-username}"),
- ComputerNamePrefix: to.Ptr("{vmss-name}"),
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
- ImageReference: &armcompute.ImageReference{
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- },
- },
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Standard_DS1_v2"),
- Capacity: to.Ptr[int64](3),
- Tier: to.Ptr("Standard"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Update_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginUpdate_virtualMachineScaleSetsUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetUpdate{
- Tags: map[string]*string{
- "key246": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"),
- },
- Identity: &armcompute.VirtualMachineScaleSetIdentity{
- Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned),
- UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{
- "key3951": {},
- },
- },
- Plan: &armcompute.Plan{
- Name: to.Ptr("windows2016"),
- Product: to.Ptr("windows-data-science-vm"),
- PromotionCode: to.Ptr("aaaaaaaaaa"),
- Publisher: to.Ptr("microsoft-ads"),
- },
- Properties: &armcompute.VirtualMachineScaleSetUpdateProperties{
- AdditionalCapabilities: &armcompute.AdditionalCapabilities{
- HibernationEnabled: to.Ptr(true),
- UltraSSDEnabled: to.Ptr(true),
- },
- AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{
- Enabled: to.Ptr(true),
- GracePeriod: to.Ptr("PT30M"),
- },
- DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true),
- Overprovision: to.Ptr(true),
- ProximityPlacementGroup: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
- },
- ScaleInPolicy: &armcompute.ScaleInPolicy{
- ForceDeletion: to.Ptr(true),
- Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{
- to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesOldestVM)},
- },
- SinglePlacementGroup: to.Ptr(true),
- UpgradePolicy: &armcompute.UpgradePolicy{
- AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{
- DisableAutomaticRollback: to.Ptr(true),
- EnableAutomaticOSUpgrade: to.Ptr(true),
- },
- Mode: to.Ptr(armcompute.UpgradeModeManual),
- RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{
- EnableCrossZoneUpgrade: to.Ptr(true),
- MaxBatchInstancePercent: to.Ptr[int32](49),
- MaxUnhealthyInstancePercent: to.Ptr[int32](81),
- MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98),
- PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"),
- PrioritizeUnhealthyInstances: to.Ptr(true),
- },
- },
- VirtualMachineProfile: &armcompute.VirtualMachineScaleSetUpdateVMProfile{
- BillingProfile: &armcompute.BillingProfile{
- MaxPrice: to.Ptr[float64](-1),
- },
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"),
- },
- },
- ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{
- ExtensionsTimeBudget: to.Ptr("PT1H20M"),
- Extensions: []*armcompute.VirtualMachineScaleSetExtension{
- {
- Name: to.Ptr("{extension-name}"),
- Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{
- Type: to.Ptr("{extension-Type}"),
- AutoUpgradeMinorVersion: to.Ptr(true),
- EnableAutomaticUpgrade: to.Ptr(true),
- ForceUpdateTag: to.Ptr("aaaaaaaaa"),
- ProtectedSettings: map[string]interface{}{},
- ProvisionAfterExtensions: []*string{
- to.Ptr("aa")},
- Publisher: to.Ptr("{extension-Publisher}"),
- Settings: map[string]interface{}{},
- SuppressFailures: to.Ptr(true),
- TypeHandlerVersion: to.Ptr("{handler-version}"),
- },
- }},
- },
- LicenseType: to.Ptr("aaaaaaaaaaaa"),
- NetworkProfile: &armcompute.VirtualMachineScaleSetUpdateNetworkProfile{
- HealthProbe: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"),
- },
- NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101),
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetUpdateNetworkConfiguration{
- {
- ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
- Name: to.Ptr("aaaaaaaa"),
- Properties: &armcompute.VirtualMachineScaleSetUpdateNetworkConfigurationProperties{
- DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete),
- DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{
- DNSServers: []*string{},
- },
- EnableAcceleratedNetworking: to.Ptr(true),
- EnableFpga: to.Ptr(true),
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetUpdateIPConfiguration{
- {
- ID: to.Ptr("aaaaaaaaaaaaaaaa"),
- Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
- Properties: &armcompute.VirtualMachineScaleSetUpdateIPConfigurationProperties{
- ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
- }},
- ApplicationSecurityGroups: []*armcompute.SubResource{
- {
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
- }},
- LoadBalancerBackendAddressPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
- }},
- LoadBalancerInboundNatPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
- }},
- Primary: to.Ptr(true),
- PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4),
- PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration{
- Name: to.Ptr("a"),
- Properties: &armcompute.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties{
- DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete),
- DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{
- DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"),
- },
- IdleTimeoutInMinutes: to.Ptr[int32](3),
- },
- },
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"),
- },
- },
- }},
- NetworkSecurityGroup: &armcompute.SubResource{
- ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
- },
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.VirtualMachineScaleSetUpdateOSProfile{
- CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"),
- LinuxConfiguration: &armcompute.LinuxConfiguration{
- DisablePasswordAuthentication: to.Ptr(true),
- PatchSettings: &armcompute.LinuxPatchSettings{
- AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault),
- PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault),
- },
- ProvisionVMAgent: to.Ptr(true),
- SSH: &armcompute.SSHConfiguration{
- PublicKeys: []*armcompute.SSHPublicKey{
- {
- Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"),
- KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"),
- }},
- },
- },
- Secrets: []*armcompute.VaultSecretGroup{
- {
- SourceVault: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- VaultCertificates: []*armcompute.VaultCertificate{
- {
- CertificateStore: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"),
- CertificateURL: to.Ptr("aaaaaaa"),
- }},
- }},
- WindowsConfiguration: &armcompute.WindowsConfiguration{
- AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{
- {
- ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"),
- Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
- PassName: to.Ptr("OobeSystem"),
- SettingName: to.Ptr(armcompute.SettingNamesAutoLogon),
- }},
- EnableAutomaticUpdates: to.Ptr(true),
- PatchSettings: &armcompute.PatchSettings{
- AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault),
- AutomaticByPlatformSettings: &armcompute.WindowsVMGuestPatchAutomaticByPlatformSettings{
- RebootSetting: to.Ptr(armcompute.WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever),
- },
- EnableHotpatching: to.Ptr(true),
- PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform),
- },
- ProvisionVMAgent: to.Ptr(true),
- TimeZone: to.Ptr("aaaaaaaaaaaaaaaa"),
- WinRM: &armcompute.WinRMConfiguration{
- Listeners: []*armcompute.WinRMListener{
- {
- CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"),
- Protocol: to.Ptr(armcompute.ProtocolTypesHTTP),
- }},
- },
- },
- },
- ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{
- TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{
- Enable: to.Ptr(true),
- NotBeforeTimeout: to.Ptr("PT10M"),
- },
- },
- SecurityProfile: &armcompute.SecurityProfile{
- EncryptionAtHost: to.Ptr(true),
- SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch),
- UefiSettings: &armcompute.UefiSettings{
- SecureBootEnabled: to.Ptr(true),
- VTpmEnabled: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.VirtualMachineScaleSetUpdateStorageProfile{
- DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{
- {
- Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"),
- Caching: to.Ptr(armcompute.CachingTypesNone),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DiskIOPSReadWrite: to.Ptr[int64](28),
- DiskMBpsReadWrite: to.Ptr[int64](15),
- DiskSizeGB: to.Ptr[int32](1023),
- Lun: to.Ptr[int32](26),
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("aaaaaaaaaaaa"),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- WriteAcceleratorEnabled: to.Ptr(true),
- }},
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"),
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SharedGalleryImageID: to.Ptr("aaaaaa"),
- SKU: to.Ptr("2016-Datacenter"),
- Version: to.Ptr("latest"),
- },
- OSDisk: &armcompute.VirtualMachineScaleSetUpdateOSDisk{
- Caching: to.Ptr(armcompute.CachingTypesReadWrite),
- DiskSizeGB: to.Ptr[int32](6),
- Image: &armcompute.VirtualHardDisk{
- URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"),
- },
- ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("aaaaaaaaaaaa"),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- VhdContainers: []*string{
- to.Ptr("aa")},
- WriteAcceleratorEnabled: to.Ptr(true),
- },
- },
- UserData: to.Ptr("aaaaaaaaaaaaa"),
- },
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("DSv3-Type1"),
- Capacity: to.Ptr[int64](7),
- Tier: to.Ptr("aaa"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Update_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginUpdate_virtualMachineScaleSetsUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetUpdate{}, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.json
-func ExampleVirtualMachineScaleSetsClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", &armcompute.VirtualMachineScaleSetsClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.json
-func ExampleVirtualMachineScaleSetsClient_Get_getVmScaleSetVmWithDiskControllerType() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.json
-func ExampleVirtualMachineScaleSetsClient_Get_getAVirtualMachineScaleSet() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.json
-func ExampleVirtualMachineScaleSetsClient_Get_getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.json
-func ExampleVirtualMachineScaleSetsClient_Get_getAVirtualMachineScaleSetWithUserData() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Deallocate_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginDeallocate_virtualMachineScaleSetsDeallocateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginDeallocateOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaa")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Deallocate_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginDeallocate_virtualMachineScaleSetsDeallocateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginDeallocateOptions{VMInstanceIDs: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_DeleteInstances_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginDeleteInstances_virtualMachineScaleSetsDeleteInstancesMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDeleteInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")},
- }, &armcompute.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions{ForceDeletion: to.Ptr(true)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_DeleteInstances_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginDeleteInstances_virtualMachineScaleSetsDeleteInstancesMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDeleteInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")},
- }, &armcompute.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions{ForceDeletion: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetInstanceView_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_GetInstanceView_virtualMachineScaleSetsGetInstanceViewMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetInstanceView(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetInstanceView_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_GetInstanceView_virtualMachineScaleSetsGetInstanceViewMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetInstanceView(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_List_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_NewListPager_virtualMachineScaleSetsListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("rgcompute", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_List_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_NewListPager_virtualMachineScaleSetsListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("rgcompute", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListAll_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_NewListAllPager_virtualMachineScaleSetsListAllMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListAllPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListAll_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_NewListAllPager_virtualMachineScaleSetsListAllMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListAllPager(nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListSkus_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_NewListSKUsPager_virtualMachineScaleSetsListSkusMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListSKUsPager("rgcompute", "aaaaaa", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListSkus_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_NewListSKUsPager_virtualMachineScaleSetsListSkusMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListSKUsPager("rgcompute", "aaaaaaaaaaaaaaaa", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetOSUpgradeHistory_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_NewGetOSUpgradeHistoryPager_virtualMachineScaleSetsGetOsUpgradeHistoryMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewGetOSUpgradeHistoryPager("rgcompute", "aaaaaa", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetOSUpgradeHistory_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_NewGetOSUpgradeHistoryPager_virtualMachineScaleSetsGetOsUpgradeHistoryMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewGetOSUpgradeHistoryPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PowerOff_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginPowerOff_virtualMachineScaleSetsPowerOffMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginPowerOffOptions{SkipShutdown: to.Ptr(true),
- VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaa")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PowerOff_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginPowerOff_virtualMachineScaleSetsPowerOffMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPowerOff(ctx, "rgcompute", "a", &armcompute.VirtualMachineScaleSetsClientBeginPowerOffOptions{SkipShutdown: nil,
- VMInstanceIDs: nil,
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Restart_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginRestart_virtualMachineScaleSetsRestartMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRestart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginRestartOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaa")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Restart_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginRestart_virtualMachineScaleSetsRestartMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRestart(ctx, "rgcompute", "aaaa", &armcompute.VirtualMachineScaleSetsClientBeginRestartOptions{VMInstanceIDs: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Start_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginStart_virtualMachineScaleSetsStartMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginStartOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaa")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Start_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginStart_virtualMachineScaleSetsStartMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginStartOptions{VMInstanceIDs: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Redeploy_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginRedeploy_virtualMachineScaleSetsRedeployMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginRedeployOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaa")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Redeploy_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginRedeploy_virtualMachineScaleSetsRedeployMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginRedeployOptions{VMInstanceIDs: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PerformMaintenance_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginPerformMaintenance_virtualMachineScaleSetsPerformMaintenanceMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaa")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PerformMaintenance_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginPerformMaintenance_virtualMachineScaleSetsPerformMaintenanceMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aa", &armcompute.VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions{VMInstanceIDs: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_UpdateInstances_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginUpdateInstances_virtualMachineScaleSetsUpdateInstancesMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdateInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")},
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_UpdateInstances_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginUpdateInstances_virtualMachineScaleSetsUpdateInstancesMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdateInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")},
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Reimage_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginReimage_virtualMachineScaleSetsReimageMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimage(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageOptions{VMScaleSetReimageInput: &armcompute.VirtualMachineScaleSetReimageParameters{
- TempDisk: to.Ptr(true),
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaa")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Reimage_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginReimage_virtualMachineScaleSetsReimageMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimage(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageOptions{VMScaleSetReimageInput: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ReimageAll_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginReimageAll_virtualMachineScaleSetsReimageAllMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageAllOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{
- InstanceIDs: []*string{
- to.Ptr("aaaaaaaaaaaaaaaaa")},
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ReimageAll_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginReimageAll_virtualMachineScaleSetsReimageAllMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageAllOptions{VMInstanceIDs: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_virtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", 30, &armcompute.VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions{Zone: nil,
- PlacementGroupID: nil,
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_virtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, "rgcompute", "aaaaaaaaaaaa", 9, &armcompute.VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions{Zone: nil,
- PlacementGroupID: nil,
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_ConvertToSinglePlacementGroup_virtualMachineScaleSetsConvertToSinglePlacementGroupMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.ConvertToSinglePlacementGroup(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VMScaleSetConvertToSinglePlacementGroupInput{
- ActivePlacementGroupID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"),
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_ConvertToSinglePlacementGroup_virtualMachineScaleSetsConvertToSinglePlacementGroupMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.ConvertToSinglePlacementGroup(ctx, "rgcompute", "aaaaaaaaaaaaa", armcompute.VMScaleSetConvertToSinglePlacementGroupInput{}, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_SetOrchestrationServiceState_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginSetOrchestrationServiceState_virtualMachineScaleSetsSetOrchestrationServiceStateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginSetOrchestrationServiceState(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", armcompute.OrchestrationServiceStateInput{
- Action: to.Ptr(armcompute.OrchestrationServiceStateActionResume),
- ServiceName: to.Ptr(armcompute.OrchestrationServiceNamesAutomaticRepairs),
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_SetOrchestrationServiceState_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetsClient_BeginSetOrchestrationServiceState_virtualMachineScaleSetsSetOrchestrationServiceStateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginSetOrchestrationServiceState(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", armcompute.OrchestrationServiceStateInput{
- Action: to.Ptr(armcompute.OrchestrationServiceStateActionResume),
- ServiceName: to.Ptr(armcompute.OrchestrationServiceNamesAutomaticRepairs),
- }, nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go
deleted file mode 100644
index 6e250abbd1eb..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go
+++ /dev/null
@@ -1,143 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_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()
- client, err := armcompute.NewVirtualMachineScaleSetVMExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", armcompute.VirtualMachineScaleSetVMExtension{
- Properties: &armcompute.VirtualMachineExtensionProperties{
- Type: to.Ptr("extType"),
- AutoUpgradeMinorVersion: to.Ptr(true),
- Publisher: to.Ptr("extPublisher"),
- Settings: map[string]interface{}{
- "UserName": "xyz@microsoft.com",
- },
- TypeHandlerVersion: to.Ptr("1.2"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_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()
- client, err := armcompute.NewVirtualMachineScaleSetVMExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", armcompute.VirtualMachineScaleSetVMExtensionUpdate{
- Properties: &armcompute.VirtualMachineExtensionUpdateProperties{
- Type: to.Ptr("extType"),
- AutoUpgradeMinorVersion: to.Ptr(true),
- Publisher: to.Ptr("extPublisher"),
- Settings: map[string]interface{}{
- "UserName": "xyz@microsoft.com",
- },
- TypeHandlerVersion: to.Ptr("1.2"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_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()
- client, err := armcompute.NewVirtualMachineScaleSetVMExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_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()
- client, err := armcompute.NewVirtualMachineScaleSetVMExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", &armcompute.VirtualMachineScaleSetVMExtensionsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_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()
- client, err := armcompute.NewVirtualMachineScaleSetVMExtensionsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.List(ctx, "myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMExtensionsClientListOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go
deleted file mode 100644
index a613b62b93e7..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go
+++ /dev/null
@@ -1,154 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.json
-func ExampleVirtualMachineScaleSetVMRunCommandsClient_BeginCreateOrUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", armcompute.VirtualMachineRunCommand{
- Location: to.Ptr("West US"),
- Properties: &armcompute.VirtualMachineRunCommandProperties{
- AsyncExecution: to.Ptr(false),
- Parameters: []*armcompute.RunCommandInputParameter{
- {
- Name: to.Ptr("param1"),
- Value: to.Ptr("value1"),
- },
- {
- Name: to.Ptr("param2"),
- Value: to.Ptr("value2"),
- }},
- RunAsPassword: to.Ptr(""),
- RunAsUser: to.Ptr("user1"),
- Source: &armcompute.VirtualMachineRunCommandScriptSource{
- Script: to.Ptr("Write-Host Hello World!"),
- },
- TimeoutInSeconds: to.Ptr[int32](3600),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.json
-func ExampleVirtualMachineScaleSetVMRunCommandsClient_BeginUpdate() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", armcompute.VirtualMachineRunCommandUpdate{
- Properties: &armcompute.VirtualMachineRunCommandProperties{
- Source: &armcompute.VirtualMachineRunCommandScriptSource{
- Script: to.Ptr("Write-Host Script Source Updated!"),
- },
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.json
-func ExampleVirtualMachineScaleSetVMRunCommandsClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.json
-func ExampleVirtualMachineScaleSetVMRunCommandsClient_Get() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", &armcompute.VirtualMachineScaleSetVMRunCommandsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.json
-func ExampleVirtualMachineScaleSetVMRunCommandsClient_NewListPager() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMRunCommandsClientListOptions{Expand: nil})
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go
deleted file mode 100644
index 4d0f58e10fa6..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go
+++ /dev/null
@@ -1,1040 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "time"
-
- "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/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Reimage_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVMsReimageMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimage(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginReimageOptions{VMScaleSetVMReimageInput: &armcompute.VirtualMachineScaleSetVMReimageParameters{
- TempDisk: to.Ptr(true),
- },
- })
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Reimage_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVMsReimageMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimage(ctx, "rgcompute", "aaaaaaa", "aaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginReimageOptions{VMScaleSetVMReimageInput: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_ReimageAll_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginReimageAll_virtualMachineScaleSetVMsReimageAllMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_ReimageAll_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginReimageAll_virtualMachineScaleSetVMsReimageAllMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Deallocate_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginDeallocate_virtualMachineScaleSetVMsDeallocateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Deallocate_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginDeallocate_virtualMachineScaleSetVMsDeallocateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Update_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginUpdate_virtualMachineScaleSetVMsUpdateMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVM{
- Location: to.Ptr("westus"),
- Tags: map[string]*string{},
- Plan: &armcompute.Plan{
- Name: to.Ptr("aaaaaaaaaa"),
- Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
- PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
- Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"),
- },
- Properties: &armcompute.VirtualMachineScaleSetVMProperties{
- AdditionalCapabilities: &armcompute.AdditionalCapabilities{
- HibernationEnabled: to.Ptr(true),
- UltraSSDEnabled: to.Ptr(true),
- },
- AvailabilitySet: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- DiagnosticsProfile: &armcompute.DiagnosticsProfile{
- BootDiagnostics: &armcompute.BootDiagnostics{
- Enabled: to.Ptr(true),
- StorageURI: to.Ptr("aaaaaaaaaaaaa"),
- },
- },
- HardwareProfile: &armcompute.HardwareProfile{
- VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesBasicA0),
- VMSizeProperties: &armcompute.VMSizeProperties{
- VCPUsAvailable: to.Ptr[int32](9),
- VCPUsPerCore: to.Ptr[int32](12),
- },
- },
- InstanceView: &armcompute.VirtualMachineScaleSetVMInstanceView{
- BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{
- Status: &armcompute.InstanceViewStatus{
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- },
- },
- Disks: []*armcompute.DiskInstanceView{
- {
- Name: to.Ptr("aaaaaaaaaaa"),
- EncryptionSettings: []*armcompute.DiskEncryptionSettings{
- {
- DiskEncryptionKey: &armcompute.KeyVaultSecretReference{
- SecretURL: to.Ptr("aaaaaaaa"),
- SourceVault: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- },
- Enabled: to.Ptr(true),
- KeyEncryptionKey: &armcompute.KeyVaultKeyReference{
- KeyURL: to.Ptr("aaaaaaaaaaaaaa"),
- SourceVault: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- },
- }},
- Statuses: []*armcompute.InstanceViewStatus{
- {
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- }},
- }},
- MaintenanceRedeployStatus: &armcompute.MaintenanceRedeployStatus{
- IsCustomerInitiatedMaintenanceAllowed: to.Ptr(true),
- LastOperationMessage: to.Ptr("aaaaaa"),
- LastOperationResultCode: to.Ptr(armcompute.MaintenanceOperationResultCodeTypesNone),
- MaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()),
- MaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()),
- PreMaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()),
- PreMaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()),
- },
- PlacementGroupID: to.Ptr("aaa"),
- PlatformFaultDomain: to.Ptr[int32](14),
- PlatformUpdateDomain: to.Ptr[int32](23),
- RdpThumbPrint: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"),
- Statuses: []*armcompute.InstanceViewStatus{
- {
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- }},
- VMAgent: &armcompute.VirtualMachineAgentInstanceView{
- ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{
- {
- Type: to.Ptr("aaaaaaaaaaaaa"),
- Status: &armcompute.InstanceViewStatus{
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- },
- TypeHandlerVersion: to.Ptr("aaaaa"),
- }},
- Statuses: []*armcompute.InstanceViewStatus{
- {
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- }},
- VMAgentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- },
- VMHealth: &armcompute.VirtualMachineHealthStatus{
- Status: &armcompute.InstanceViewStatus{
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- },
- },
- Extensions: []*armcompute.VirtualMachineExtensionInstanceView{
- {
- Name: to.Ptr("aaaaaaaaaaaaaaaaa"),
- Type: to.Ptr("aaaaaaaaa"),
- Statuses: []*armcompute.InstanceViewStatus{
- {
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- }},
- Substatuses: []*armcompute.InstanceViewStatus{
- {
- Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
- DisplayStatus: to.Ptr("aaaaaa"),
- Level: to.Ptr(armcompute.StatusLevelTypesInfo),
- Message: to.Ptr("a"),
- Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()),
- }},
- TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"),
- }},
- },
- LicenseType: to.Ptr("aaaaaaaaaa"),
- NetworkProfile: &armcompute.NetworkProfile{
- NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101),
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{
- {
- Name: to.Ptr("aaaaaaaaaaa"),
- Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{
- DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete),
- DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{
- DNSServers: []*string{
- to.Ptr("aaaaaa")},
- },
- DscpConfiguration: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- EnableAcceleratedNetworking: to.Ptr(true),
- EnableFpga: to.Ptr(true),
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{
- {
- Name: to.Ptr("aa"),
- Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{
- ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- }},
- ApplicationSecurityGroups: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- }},
- LoadBalancerBackendAddressPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- }},
- Primary: to.Ptr(true),
- PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4),
- PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{
- Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
- Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{
- DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete),
- DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{
- DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"),
- },
- IdleTimeoutInMinutes: to.Ptr[int32](2),
- IPTags: []*armcompute.VirtualMachineIPTag{
- {
- IPTagType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"),
- Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
- }},
- PublicIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4),
- PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodDynamic),
- PublicIPPrefix: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- },
- SKU: &armcompute.PublicIPAddressSKU{
- Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic),
- Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional),
- },
- },
- Subnet: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- },
- }},
- NetworkSecurityGroup: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- Primary: to.Ptr(true),
- },
- }},
- NetworkInterfaces: []*armcompute.NetworkInterfaceReference{
- {
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"),
- Properties: &armcompute.NetworkInterfaceReferenceProperties{
- DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete),
- Primary: to.Ptr(true),
- },
- }},
- },
- NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{
- NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
- {
- ID: to.Ptr("aaaaaaaa"),
- Name: to.Ptr("vmsstestnetconfig5415"),
- Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{
- DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete),
- DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{
- DNSServers: []*string{},
- },
- EnableAcceleratedNetworking: to.Ptr(true),
- EnableFpga: to.Ptr(true),
- EnableIPForwarding: to.Ptr(true),
- IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{
- {
- ID: to.Ptr("aaaaaaaaa"),
- Name: to.Ptr("vmsstestnetconfig9693"),
- Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{
- ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- }},
- ApplicationSecurityGroups: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- }},
- LoadBalancerBackendAddressPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- }},
- LoadBalancerInboundNatPools: []*armcompute.SubResource{
- {
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- }},
- Primary: to.Ptr(true),
- PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4),
- PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{
- Name: to.Ptr("aaaaaaaaaaaaaaaaaa"),
- Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{
- DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete),
- DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{
- DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"),
- },
- IdleTimeoutInMinutes: to.Ptr[int32](18),
- IPTags: []*armcompute.VirtualMachineScaleSetIPTag{
- {
- IPTagType: to.Ptr("aaaaaaa"),
- Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"),
- }},
- PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4),
- PublicIPPrefix: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- },
- SKU: &armcompute.PublicIPAddressSKU{
- Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic),
- Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional),
- },
- },
- Subnet: &armcompute.APIEntityReference{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"),
- },
- },
- }},
- NetworkSecurityGroup: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- Primary: to.Ptr(true),
- },
- }},
- },
- OSProfile: &armcompute.OSProfile{
- AdminPassword: to.Ptr("aaaaaaaaaaaaaaaa"),
- AdminUsername: to.Ptr("Foo12"),
- AllowExtensionOperations: to.Ptr(true),
- ComputerName: to.Ptr("test000000"),
- CustomData: to.Ptr("aaaa"),
- LinuxConfiguration: &armcompute.LinuxConfiguration{
- DisablePasswordAuthentication: to.Ptr(true),
- PatchSettings: &armcompute.LinuxPatchSettings{
- AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault),
- PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault),
- },
- ProvisionVMAgent: to.Ptr(true),
- SSH: &armcompute.SSHConfiguration{
- PublicKeys: []*armcompute.SSHPublicKey{
- {
- Path: to.Ptr("aaa"),
- KeyData: to.Ptr("aaaaaa"),
- }},
- },
- },
- RequireGuestProvisionSignal: to.Ptr(true),
- Secrets: []*armcompute.VaultSecretGroup{},
- WindowsConfiguration: &armcompute.WindowsConfiguration{
- AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{
- {
- ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"),
- Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
- PassName: to.Ptr("OobeSystem"),
- SettingName: to.Ptr(armcompute.SettingNamesAutoLogon),
- }},
- EnableAutomaticUpdates: to.Ptr(true),
- PatchSettings: &armcompute.PatchSettings{
- AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault),
- EnableHotpatching: to.Ptr(true),
- PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual),
- },
- ProvisionVMAgent: to.Ptr(true),
- TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"),
- WinRM: &armcompute.WinRMConfiguration{
- Listeners: []*armcompute.WinRMListener{
- {
- CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"),
- Protocol: to.Ptr(armcompute.ProtocolTypesHTTP),
- }},
- },
- },
- },
- ProtectionPolicy: &armcompute.VirtualMachineScaleSetVMProtectionPolicy{
- ProtectFromScaleIn: to.Ptr(true),
- ProtectFromScaleSetActions: to.Ptr(true),
- },
- SecurityProfile: &armcompute.SecurityProfile{
- EncryptionAtHost: to.Ptr(true),
- SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch),
- UefiSettings: &armcompute.UefiSettings{
- SecureBootEnabled: to.Ptr(true),
- VTpmEnabled: to.Ptr(true),
- },
- },
- StorageProfile: &armcompute.StorageProfile{
- DataDisks: []*armcompute.DataDisk{
- {
- Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"),
- Caching: to.Ptr(armcompute.CachingTypesNone),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty),
- DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete),
- DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach),
- DiskSizeGB: to.Ptr[int32](128),
- Image: &armcompute.VirtualHardDisk{
- URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"),
- },
- Lun: to.Ptr[int32](1),
- ManagedDisk: &armcompute.ManagedDiskParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"),
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("aaaaaaaaaaaa"),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- ToBeDetached: to.Ptr(true),
- Vhd: &armcompute.VirtualHardDisk{
- URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"),
- },
- WriteAcceleratorEnabled: to.Ptr(true),
- }},
- ImageReference: &armcompute.ImageReference{
- ID: to.Ptr("a"),
- Offer: to.Ptr("WindowsServer"),
- Publisher: to.Ptr("MicrosoftWindowsServer"),
- SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
- SKU: to.Ptr("2012-R2-Datacenter"),
- Version: to.Ptr("4.127.20180315"),
- },
- OSDisk: &armcompute.OSDisk{
- Name: to.Ptr("vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"),
- Caching: to.Ptr(armcompute.CachingTypesNone),
- CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage),
- DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete),
- DiffDiskSettings: &armcompute.DiffDiskSettings{
- Option: to.Ptr(armcompute.DiffDiskOptionsLocal),
- Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk),
- },
- DiskSizeGB: to.Ptr[int32](127),
- EncryptionSettings: &armcompute.DiskEncryptionSettings{
- DiskEncryptionKey: &armcompute.KeyVaultSecretReference{
- SecretURL: to.Ptr("aaaaaaaa"),
- SourceVault: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- },
- Enabled: to.Ptr(true),
- KeyEncryptionKey: &armcompute.KeyVaultKeyReference{
- KeyURL: to.Ptr("aaaaaaaaaaaaaa"),
- SourceVault: &armcompute.SubResource{
- ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
- },
- },
- },
- Image: &armcompute.VirtualHardDisk{
- URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"),
- },
- ManagedDisk: &armcompute.ManagedDiskParameters{
- ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"),
- DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{
- ID: to.Ptr("aaaaaaaaaaaa"),
- },
- StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS),
- },
- OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
- Vhd: &armcompute.VirtualHardDisk{
- URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"),
- },
- WriteAcceleratorEnabled: to.Ptr(true),
- },
- },
- UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="),
- },
- SKU: &armcompute.SKU{
- Name: to.Ptr("Classic"),
- Capacity: to.Ptr[int64](29),
- Tier: to.Ptr("aaaaaaaaaaaaaa"),
- },
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Update_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginUpdate_virtualMachineScaleSetVMsUpdateMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVM{
- Location: to.Ptr("westus"),
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginDelete() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMsClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.json
-func ExampleVirtualMachineScaleSetVMsClient_Get_getVmScaleSetVmWithUserData() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "{vmss-name}", "0", &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.json
-func ExampleVirtualMachineScaleSetVMsClient_Get_getVmScaleSetVmWithVmSizeProperties() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.Get(ctx, "myResourceGroup", "{vmss-name}", "0", &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json
-func ExampleVirtualMachineScaleSetVMsClient_GetInstanceView() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.GetInstanceView(ctx, "myResourceGroup", "myVirtualMachineScaleSet", "0", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_List_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_NewListPager_virtualMachineScaleSetVMsListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: to.Ptr("aaaaaaaaaaaaaa"),
- Select: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"),
- Expand: to.Ptr("aaaaaaaaaaaaa"),
- })
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_List_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_NewListPager_virtualMachineScaleSetVMsListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: nil,
- Select: nil,
- Expand: nil,
- })
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PowerOff_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginPowerOff_virtualMachineScaleSetVMsPowerOffMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPowerOff(ctx, "rgcompute", "aaaaaa", "aaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginPowerOffOptions{SkipShutdown: to.Ptr(true)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PowerOff_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginPowerOff_virtualMachineScaleSetVMsPowerOffMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginPowerOffOptions{SkipShutdown: nil})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Restart_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginRestart_virtualMachineScaleSetVMsRestartMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRestart(ctx, "rgcompute", "aa", "aaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Restart_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginRestart_virtualMachineScaleSetVMsRestartMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRestart(ctx, "rgcompute", "aaaaaaaaaaaa", "aaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Start_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginStart_virtualMachineScaleSetVMsStartMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Start_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginStart_virtualMachineScaleSetVMsStartMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Redeploy_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginRedeploy_virtualMachineScaleSetVMsRedeployMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Redeploy_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginRedeploy_virtualMachineScaleSetVMsRedeployMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.json
-func ExampleVirtualMachineScaleSetVMsClient_RetrieveBootDiagnosticsData() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- res, err := client.RetrieveBootDiagnosticsData(ctx, "ResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions{SasURIExpirationTimeInMinutes: to.Ptr[int32](60)})
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- // TODO: use response item
- _ = res
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PerformMaintenance_MaximumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginPerformMaintenance_virtualMachineScaleSetVMsPerformMaintenanceMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PerformMaintenance_MinimumSet_Gen.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginPerformMaintenance_virtualMachineScaleSetVMsPerformMaintenanceMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaa", "aaaa", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
- _, err = poller.PollUntilDone(ctx, nil)
- if err != nil {
- log.Fatalf("failed to pull the result: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.json
-func ExampleVirtualMachineScaleSetVMsClient_SimulateEviction() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- _, err = client.SimulateEviction(ctx, "ResourceGroup", "VmScaleSetName", "InstanceId", nil)
- if err != nil {
- log.Fatalf("failed to finish the request: %v", err)
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand.json
-func ExampleVirtualMachineScaleSetVMsClient_BeginRunCommand() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineScaleSetVMsClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- poller, err := client.BeginRunCommand(ctx, "myResourceGroup", "myVirtualMachineScaleSet", "0", armcompute.RunCommandInput{
- CommandID: to.Ptr("RunPowerShellScript"),
- Script: []*string{
- to.Ptr("Write-Host Hello World!")},
- }, 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)
- }
- // TODO: use response item
- _ = res
-}
diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client_example_test.go
deleted file mode 100644
index 88da31166bc1..000000000000
--- a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client_example_test.go
+++ /dev/null
@@ -1,65 +0,0 @@
-//go:build go1.18
-// +build go1.18
-
-// 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) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-package armcompute_test
-
-import (
- "context"
- "log"
-
- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
- "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
-)
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.json
-func ExampleVirtualMachineSizesClient_NewListPager_virtualMachineSizesListMaximumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineSizesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("-e", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}
-
-// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.json
-func ExampleVirtualMachineSizesClient_NewListPager_virtualMachineSizesListMinimumSetGen() {
- cred, err := azidentity.NewDefaultAzureCredential(nil)
- if err != nil {
- log.Fatalf("failed to obtain a credential: %v", err)
- }
- ctx := context.Background()
- client, err := armcompute.NewVirtualMachineSizesClient("{subscription-id}", cred, nil)
- if err != nil {
- log.Fatalf("failed to create client: %v", err)
- }
- pager := client.NewListPager("._..", nil)
- for pager.More() {
- nextResult, err := pager.NextPage(ctx)
- if err != nil {
- log.Fatalf("failed to advance page: %v", err)
- }
- for _, v := range nextResult.Value {
- // TODO: use page item
- _ = v
- }
- }
-}