From 76d90e92c638e2838202189ddba088bc53151930 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 5 May 2023 01:15:07 +0000 Subject: [PATCH] CodeGen from PR 23823 in Azure/azure-rest-api-specs Merge bc46f18786439d719514e4db1ee7ac6a3faee361 into 104416d2165e106d35e41a45583129765a6cc5ba --- .../compute/armcompute/CHANGELOG.md | 19 + .../compute/armcompute/autorest.md | 6 +- .../armcompute/availabilityset_live_test.go | 117 - .../availabilitysets_client_example_test.go | 629 -- .../capacityreservation_live_test.go | 122 - ...tyreservationgroups_client_example_test.go | 402 - ...apacityreservations_client_example_test.go | 386 - ...iceoperatingsystems_client_example_test.go | 207 - ...erviceroleinstances_client_example_test.go | 289 - .../cloudserviceroles_client_example_test.go | 108 - .../cloudservices_client_example_test.go | 1242 --- ...ervicesupdatedomain_client_example_test.go | 99 - .../armcompute/communitygalleries_client.go | 4 +- .../communitygalleries_client_example_test.go | 46 - .../communitygalleryimages_client.go | 8 +- ...munitygalleryimages_client_example_test.go | 103 - .../communitygalleryimageversions_client.go | 8 +- ...alleryimageversions_client_example_test.go | 103 - .../armcompute/computerpcommon_live_test.go | 100 - .../compute/armcompute/constants.go | 9 +- .../armcompute/dedicatedhost_live_test.go | 174 - ...dedicatedhostgroups_client_example_test.go | 616 -- .../dedicatedhosts_client_example_test.go | 425 - .../compute/armcompute/disk_live_test.go | 137 - .../armcompute/diskaccess_live_test.go | 129 - .../diskaccesses_client_example_test.go | 529 - .../diskencryptionsets_client_example_test.go | 657 -- .../diskrestorepoint_client_example_test.go | 183 - .../armcompute/disks_client_example_test.go | 2115 ---- .../compute/armcompute/galleries_client.go | 30 +- .../galleries_client_example_test.go | 521 - .../compute/armcompute/gallery_live_test.go | 265 - .../armcompute/galleryapplications_client.go | 26 +- ...galleryapplications_client_example_test.go | 285 - .../galleryapplicationversions_client.go | 26 +- ...applicationversions_client_example_test.go | 473 - .../armcompute/galleryimages_client.go | 26 +- .../galleryimages_client_example_test.go | 219 - .../armcompute/galleryimageversions_client.go | 26 +- ...alleryimageversions_client_example_test.go | 1852 ---- .../gallerysharingprofile_client.go | 6 +- ...llerysharingprofile_client_example_test.go | 130 - sdk/resourcemanager/compute/armcompute/go.mod | 20 +- sdk/resourcemanager/compute/armcompute/go.sum | 33 - .../armcompute/images_client_example_test.go | 946 -- .../loganalytics_client_example_test.go | 93 - .../compute/armcompute/models.go | 72 +- .../compute/armcompute/models_serde.go | 145 +- .../operations_client_example_test.go | 83 - .../proximityplacementgroup_live_test.go | 118 - ...mityplacementgroups_client_example_test.go | 277 - .../resourceskus_client_example_test.go | 612 -- .../armcompute/restorepoint_live_test.go | 291 - ...orepointcollections_client_example_test.go | 634 -- .../restorepoints_client_example_test.go | 315 - .../armcompute/runcommand_live_test.go | 495 - .../armcompute/sharedgalleries_client.go | 8 +- .../sharedgalleries_client_example_test.go | 80 - .../armcompute/sharedgalleryimages_client.go | 8 +- ...sharedgalleryimages_client_example_test.go | 102 - .../sharedgalleryimageversions_client.go | 8 +- ...alleryimageversions_client_example_test.go | 102 - .../compute/armcompute/skus_live_test.go | 73 - .../compute/armcompute/snapshot_live_test.go | 141 - .../snapshots_client_example_test.go | 697 -- .../armcompute/sshpublickey_live_test.go | 113 - .../sshpublickeys_client_example_test.go | 349 - .../armcompute/usage_client_example_test.go | 90 - .../armcompute/virtualmachine_live_test.go | 348 - .../virtualmachineextensionimage_live_test.go | 82 - ...hineextensionimages_client_example_test.go | 209 - ...almachineextensions_client_example_test.go | 437 - .../virtualmachineimage_live_test.go | 93 - ...irtualmachineimages_client_example_test.go | 403 - ...chineimagesedgezone_client_example_test.go | 339 - ...lmachineruncommands_client_example_test.go | 416 - .../virtualmachines_client_example_test.go | 9120 ---------------- .../virtualmachinescaleset_live_test.go | 399 - ...escalesetextensions_client_example_test.go | 374 - ...esetrollingupgrades_client_example_test.go | 214 - ...ualmachinescalesets_client_example_test.go | 9571 ----------------- ...calesetvmextensions_client_example_test.go | 226 - ...alesetvmruncommands_client_example_test.go | 266 - ...lmachinescalesetvms_client_example_test.go | 2362 ---- ...virtualmachinesizes_client_example_test.go | 89 - 85 files changed, 319 insertions(+), 43391 deletions(-) delete mode 100644 sdk/resourcemanager/compute/armcompute/availabilityset_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/capacityreservation_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/computerpcommon_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/dedicatedhost_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/disk_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/diskaccess_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/disks_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/gallery_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/images_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/proximityplacementgroup_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/restorepoint_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/restorepoints_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/runcommand_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/skus_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/snapshot_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/sshpublickey_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/usage_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachine_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachineextensionimage_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachineimage_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachinescaleset_live_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client_example_test.go diff --git a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md index 1d41ffefe884..e6fcacb868eb 100644 --- a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md +++ b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md @@ -1,5 +1,24 @@ # Release History +## 5.0.0 (2023-05-05) +### Breaking Changes + +- Field `ID` of struct `VirtualMachineScaleSetIPConfiguration` has been removed +- Field `ID` of struct `VirtualMachineScaleSetNetworkConfiguration` has been removed + +### Features Added + +- New struct `CommunityGalleryMetadata` +- New struct `CommunityGalleryProperties` +- New struct `SharedGalleryProperties` +- New field `Properties` in struct `CommunityGallery` +- New field `ArtifactTags`, `Disclaimer` in struct `CommunityGalleryImageProperties` +- New field `ArtifactTags`, `Disclaimer` in struct `CommunityGalleryImageVersionProperties` +- New field `Properties` in struct `SharedGallery` +- New field `ArtifactTags` in struct `SharedGalleryImageProperties` +- New field `ArtifactTags` in struct `SharedGalleryImageVersionProperties` + + ## 4.2.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/compute/armcompute/autorest.md b/sdk/resourcemanager/compute/armcompute/autorest.md index 31fe98659aec..f027a1114a20 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/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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.2.1 +module-version: 5.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/compute/armcompute/availabilityset_live_test.go b/sdk/resourcemanager/compute/armcompute/availabilityset_live_test.go deleted file mode 100644 index 938bb22c9b5a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/availabilityset_live_test.go +++ /dev/null @@ -1,117 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type AvailabilitySetTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - location string - resourceGroupName string - subscriptionId string - availabilitySetName string -} - -func (testsuite *AvailabilitySetTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.availabilitySetName = testutil.GenerateAlphaNumericID(testsuite.T(), "availabili", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *AvailabilitySetTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestAvailabilitySetTestSuite(t *testing.T) { - suite.Run(t, new(AvailabilitySetTestSuite)) -} - -// Microsoft.Compute/availabilitySets -func (testsuite *AvailabilitySetTestSuite) TestAvailabilitySets() { - var err error - // From step AvailabilitySets_CreateOrUpdate - fmt.Println("Call operation: AvailabilitySets_CreateOrUpdate") - availabilitySetsClient, err := armcompute.NewAvailabilitySetsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = availabilitySetsClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.availabilitySetName, armcompute.AvailabilitySet{ - Location: to.Ptr(testsuite.location), - Properties: &armcompute.AvailabilitySetProperties{ - PlatformFaultDomainCount: to.Ptr[int32](2), - PlatformUpdateDomainCount: to.Ptr[int32](20), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step AvailabilitySets_ListBySubscription - fmt.Println("Call operation: AvailabilitySets_ListBySubscription") - availabilitySetsClientNewListBySubscriptionPager := availabilitySetsClient.NewListBySubscriptionPager(&armcompute.AvailabilitySetsClientListBySubscriptionOptions{Expand: nil}) - for availabilitySetsClientNewListBySubscriptionPager.More() { - _, err := availabilitySetsClientNewListBySubscriptionPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step AvailabilitySets_List - fmt.Println("Call operation: AvailabilitySets_List") - availabilitySetsClientNewListPager := availabilitySetsClient.NewListPager(testsuite.resourceGroupName, nil) - for availabilitySetsClientNewListPager.More() { - _, err := availabilitySetsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step AvailabilitySets_Get - fmt.Println("Call operation: AvailabilitySets_Get") - _, err = availabilitySetsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.availabilitySetName, nil) - testsuite.Require().NoError(err) - - // From step AvailabilitySets_ListAvailableSizes - fmt.Println("Call operation: AvailabilitySets_ListAvailableSizes") - availabilitySetsClientNewListAvailableSizesPager := availabilitySetsClient.NewListAvailableSizesPager(testsuite.resourceGroupName, testsuite.availabilitySetName, nil) - for availabilitySetsClientNewListAvailableSizesPager.More() { - _, err := availabilitySetsClientNewListAvailableSizesPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step AvailabilitySets_Update - fmt.Println("Call operation: AvailabilitySets_Update") - _, err = availabilitySetsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.availabilitySetName, armcompute.AvailabilitySetUpdate{}, nil) - testsuite.Require().NoError(err) - - // From step AvailabilitySets_Delete - fmt.Println("Call operation: AvailabilitySets_Delete") - _, err = availabilitySetsClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.availabilitySetName, nil) - testsuite.Require().NoError(err) -} 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 e026106b56ad..000000000000 --- a/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go +++ /dev/null @@ -1,629 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Name: to.Ptr("myAvailabilitySet"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](2), - // PlatformUpdateDomainCount: to.Ptr[int32](20), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Name: to.Ptr("myAvailabilitySet"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key2505": to.Ptr("aa"), - // "key9626": to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }, - // 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}"), - // }, - // 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}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.AvailabilitySetUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAvailabilitySetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAvailabilitySetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Name: to.Ptr("myAvailabilitySet"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key2505": to.Ptr("aa"), - // "key9626": to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }, - // 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}"), - // }, - // 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}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListBySubscriptionPager(&armcompute.AvailabilitySetsClientListBySubscriptionOptions{Expand: to.Ptr("virtualMachines\\$ref")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{ - // Value: []*armcompute.AvailabilitySet{ - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{ - // Value: []*armcompute.AvailabilitySet{ - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Tags: map[string]*string{ - // "key2039": to.Ptr("aaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](22), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Tags: map[string]*string{ - // "key5849": to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](23), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](26), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](6), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{ - // Value: []*armcompute.AvailabilitySet{ - // { - // Location: to.Ptr("australiasoutheast"), - // }, - // { - // Location: to.Ptr("australiasoutheast"), - // }, - // { - // Location: to.Ptr("westcentralus"), - // }, - // { - // Location: to.Ptr("westcentralus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListAvailableSizesPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // Value: []*armcompute.VirtualMachineSize{ - // { - // Name: to.Ptr("Standard_A1_V2"), - // MaxDataDiskCount: to.Ptr[int32](2), - // MemoryInMB: to.Ptr[int32](2048), - // NumberOfCores: to.Ptr[int32](1), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](10240), - // }, - // { - // Name: to.Ptr("Standard_A2_V2"), - // MaxDataDiskCount: to.Ptr[int32](4), - // MemoryInMB: to.Ptr[int32](4096), - // NumberOfCores: to.Ptr[int32](2), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](20480), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListAvailableSizesPager("rgcompute", "aa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservation_live_test.go b/sdk/resourcemanager/compute/armcompute/capacityreservation_live_test.go deleted file mode 100644 index 768fca18eae0..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservation_live_test.go +++ /dev/null @@ -1,122 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type CapacityReservationTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - capacityReservationGroupName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *CapacityReservationTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.capacityReservationGroupName = testutil.GenerateAlphaNumericID(testsuite.T(), "capacityre", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *CapacityReservationTestSuite) TearDownSuite() { - testsuite.Cleanup() - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestCapacityReservationTestSuite(t *testing.T) { - suite.Run(t, new(CapacityReservationTestSuite)) -} - -func (testsuite *CapacityReservationTestSuite) Prepare() { - var err error - // From step CapacityReservationGroups_CreateOrUpdate - fmt.Println("Call operation: CapacityReservationGroups_CreateOrUpdate") - capacityReservationGroupsClient, err := armcompute.NewCapacityReservationGroupsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = capacityReservationGroupsClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.capacityReservationGroupName, armcompute.CapacityReservationGroup{ - Location: to.Ptr(testsuite.location), - Tags: map[string]*string{ - "department": to.Ptr("finance"), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("2")}, - }, nil) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/capacityReservationGroups -func (testsuite *CapacityReservationTestSuite) TestCapacityReservationGroups() { - var err error - // From step CapacityReservationGroups_ListBySubscription - fmt.Println("Call operation: CapacityReservationGroups_ListBySubscription") - capacityReservationGroupsClient, err := armcompute.NewCapacityReservationGroupsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - capacityReservationGroupsClientNewListBySubscriptionPager := capacityReservationGroupsClient.NewListBySubscriptionPager(&armcompute.CapacityReservationGroupsClientListBySubscriptionOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)}) - for capacityReservationGroupsClientNewListBySubscriptionPager.More() { - _, err := capacityReservationGroupsClientNewListBySubscriptionPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step CapacityReservationGroups_ListByResourceGroup - fmt.Println("Call operation: CapacityReservationGroups_ListByResourceGroup") - capacityReservationGroupsClientNewListByResourceGroupPager := capacityReservationGroupsClient.NewListByResourceGroupPager(testsuite.resourceGroupName, &armcompute.CapacityReservationGroupsClientListByResourceGroupOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)}) - for capacityReservationGroupsClientNewListByResourceGroupPager.More() { - _, err := capacityReservationGroupsClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step CapacityReservationGroups_Get - fmt.Println("Call operation: CapacityReservationGroups_Get") - _, err = capacityReservationGroupsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.capacityReservationGroupName, &armcompute.CapacityReservationGroupsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationGroupInstanceViewTypesInstanceView)}) - testsuite.Require().NoError(err) - - // From step CapacityReservationGroups_Update - fmt.Println("Call operation: CapacityReservationGroups_Update") - _, err = capacityReservationGroupsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.capacityReservationGroupName, armcompute.CapacityReservationGroupUpdate{}, nil) - testsuite.Require().NoError(err) -} - -func (testsuite *CapacityReservationTestSuite) Cleanup() { - var err error - // From step CapacityReservationGroups_Delete - fmt.Println("Call operation: CapacityReservationGroups_Delete") - capacityReservationGroupsClient, err := armcompute.NewCapacityReservationGroupsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = capacityReservationGroupsClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.capacityReservationGroupName, nil) - testsuite.Require().NoError(err) -} 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 bee6eacc7d35..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go +++ /dev/null @@ -1,402 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Name: to.Ptr("myCapacityReservationGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/myCapacityReservationGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("finance"), - // "owner": to.Ptr("myCompany"), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Name: to.Ptr("myCapacityReservationGroup"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/myCapacityReservationGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.CapacityReservationGroupInstanceView{ - // CapacityReservations: []*armcompute.CapacityReservationInstanceViewWithName{ - // { - // 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{ - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // Name: to.Ptr("aaaaaaaaaaaaaaaa"), - // }}, - // }, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationGroupUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCapacityReservationGroupsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCapacityReservationGroupsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().Get(ctx, "myResourceGroup", "myCapacityReservationGroup", &armcompute.CapacityReservationGroupsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationGroupInstanceViewTypesInstanceView)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Name: to.Ptr("myCapacityReservationGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"), - // }}, - // InstanceView: &armcompute.CapacityReservationGroupInstanceView{ - // CapacityReservations: []*armcompute.CapacityReservationInstanceViewWithName{ - // { - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // CurrentCapacity: to.Ptr[int32](5), - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // Name: to.Ptr("myCapacityReservation1"), - // }, - // { - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // CurrentCapacity: to.Ptr[int32](5), - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"), - // }}, - // }, - // Name: to.Ptr("myCapacityReservation2"), - // }}, - // }, - // }, - // Zones: []*string{ - // to.Ptr("3"), - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapacityReservationGroupsClient().NewListByResourceGroupPager("myResourceGroup", &armcompute.CapacityReservationGroupsClientListByResourceGroupOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapacityReservationGroupListResult = armcompute.CapacityReservationGroupListResult{ - // Value: []*armcompute.CapacityReservationGroup{ - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation3"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation4"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapacityReservationGroupsClient().NewListBySubscriptionPager(&armcompute.CapacityReservationGroupsClientListBySubscriptionOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapacityReservationGroupListResult = armcompute.CapacityReservationGroupListResult{ - // Value: []*armcompute.CapacityReservationGroup{ - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation3"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation4"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // }}, - // } - } -} 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 724ab35c60d6..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go +++ /dev/null @@ -1,386 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Name: to.Ptr("myCapacityReservation"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Name: to.Ptr("myCapacityReservation"), - // Type: to.Ptr("aaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // 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{ - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Location: to.Ptr("westus"), - // SKU: &armcompute.SKU{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationsClient().Get(ctx, "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", &armcompute.CapacityReservationsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationInstanceViewTypesInstanceView)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Name: to.Ptr("myCapacityReservation"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // InstanceView: &armcompute.CapacityReservationInstanceView{ - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // CurrentCapacity: to.Ptr[int32](5), - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapacityReservationsClient().NewListByCapacityReservationGroupPager("myResourceGroup", "myCapacityReservationGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapacityReservationListResult = armcompute.CapacityReservationListResult{ - // Value: []*armcompute.CapacityReservation{ - // { - // Name: to.Ptr("{capacityReservationName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservations"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }, - // { - // Name: to.Ptr("{capacityReservationName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservations"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_A1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} 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 19597e85b412..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceOperatingSystemsClient().GetOSVersion(ctx, "westus2", "WA-GUEST-OS-3.90_202010-02", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OSVersion = armcompute.OSVersion{ - // Name: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-3.90_202010-02"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSVersionProperties{ - // Family: to.Ptr("3"), - // FamilyLabel: to.Ptr("Windows Server 2012"), - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceOperatingSystemsClient().NewListOSVersionsPager("westus2", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OSVersionListResult = armcompute.OSVersionListResult{ - // Value: []*armcompute.OSVersion{ - // { - // Name: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-3.90_202010-02"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSVersionProperties{ - // Family: to.Ptr("3"), - // FamilyLabel: to.Ptr("Windows Server 2012"), - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }, - // }, - // { - // Name: to.Ptr("WA-GUEST-OS-4.83_202010-02"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-4.83_202010-02"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSVersionProperties{ - // Family: to.Ptr("4"), - // FamilyLabel: to.Ptr("Windows Server 2012 R2"), - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 4.83 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-4.83_202010-02"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceOperatingSystemsClient().GetOSFamily(ctx, "westus2", "3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OSFamily = armcompute.OSFamily{ - // Name: to.Ptr("3"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/3"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSFamilyProperties{ - // Name: to.Ptr("3"), - // Label: to.Ptr("Windows Server 2012"), - // Versions: []*armcompute.OSVersionPropertiesBase{ - // { - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceOperatingSystemsClient().NewListOSFamiliesPager("westus2", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OSFamilyListResult = armcompute.OSFamilyListResult{ - // Value: []*armcompute.OSFamily{ - // { - // Name: to.Ptr("3"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/3"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSFamilyProperties{ - // Name: to.Ptr("3"), - // Label: to.Ptr("Windows Server 2012"), - // Versions: []*armcompute.OSVersionPropertiesBase{ - // { - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("4"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/4"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSFamilyProperties{ - // Name: to.Ptr("4"), - // Label: to.Ptr("Windows Server 2012 R2"), - // Versions: []*armcompute.OSVersionPropertiesBase{ - // { - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 4.83 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-4.83_202010-02"), - // }}, - // }, - // }}, - // } - } -} 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 83979ebf2e32..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go +++ /dev/null @@ -1,289 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceRoleInstancesClient().Get(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleInstance = armcompute.RoleInstance{ - // Name: to.Ptr("{roleInstance-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/{roleInstance-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/{roleInstance-name}/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceRoleInstancesClient().GetInstanceView(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleInstanceView = armcompute.RoleInstanceView{ - // PlatformFaultDomain: to.Ptr[int32](0), - // PlatformUpdateDomain: to.Ptr[int32](0), - // PrivateID: to.Ptr("3491bc0c-1f6c-444f-b1d0-ec0751a74e3e"), - // Statuses: []*armcompute.ResourceInstanceViewStatus{ - // { - // Code: to.Ptr("RoleState/RoleStateStarted"), - // DisplayStatus: to.Ptr("RoleStateStarted"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr(""), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceRoleInstancesClient().NewListPager("ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleInstanceListResult = armcompute.RoleInstanceListResult{ - // Value: []*armcompute.RoleInstance{ - // { - // Name: to.Ptr("ContosoFrontend_IN_0"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_0"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_0/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoFrontend_IN_1"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_1"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_1/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend_IN_0"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_0"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_0/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend_IN_1"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_1"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_1/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCloudServiceRoleInstancesClient().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 8a3ee4694386..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go +++ /dev/null @@ -1,108 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceRolesClient().Get(ctx, "{role-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudServiceRole = armcompute.CloudServiceRole{ - // Name: to.Ptr("{role-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roles"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/{role-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceRoleProperties{ - // UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:{role-name}"), - // }, - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceRolesClient().NewListPager("ConstosoRG", "{cs-name}", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CloudServiceRoleListResult = armcompute.CloudServiceRoleListResult{ - // Value: []*armcompute.CloudServiceRole{ - // { - // Name: to.Ptr("ContosoFrontend"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roles"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/ContosoFrontend"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceRoleProperties{ - // UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:ContosoFrontend"), - // }, - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roles"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/ContosoBackend"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceRoleProperties{ - // UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:ContosoBackend"), - // }, - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} 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 9043a684ec78..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go +++ /dev/null @@ -1,1242 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // 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{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("7f3edf91-cb34-4a3e-971a-177dc3dd43cb"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithMultiRole_WithZones.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithMultipleRolesInASpecificAvailabilityZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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), - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // 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{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("7f3edf91-cb34-4a3e-971a-177dc3dd43cb"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/5393f919-a68a-43d0-9063-4b2bda6bffdf/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // 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"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("14d10b45-ced7-42ef-a406-50a3df2cea7d"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // 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}"), - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("60b6cd59-600b-4e02-b717-521b07aa94bf"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // 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"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("c948cccb-bbfa-4516-a250-c28abc4d0c15"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // 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{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // Tags: map[string]*string{ - // "Documentation": to.Ptr("RestAPI"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServicesClient().Get(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // Settings: "userazure01/12/2022 16:29:02", - // 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"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServicesClient().GetInstanceView(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudServiceInstanceView = armcompute.CloudServiceInstanceView{ - // PrivateIDs: []*string{ - // to.Ptr("3491bc0c-1f6c-444f-b1d0-ec0751a74e3e")}, - // RoleInstance: &armcompute.InstanceViewStatusesSummary{ - // StatusesSummary: []*armcompute.StatusCodeCount{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // Count: to.Ptr[int32](4), - // }, - // { - // Code: to.Ptr("PowerState/started"), - // Count: to.Ptr[int32](4), - // }, - // { - // Code: to.Ptr("RoleState/RoleStateStarted"), - // Count: to.Ptr[int32](4), - // }}, - // }, - // SdkVersion: to.Ptr("2.9.6496.3"), - // Statuses: []*armcompute.ResourceInstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-12T16:50:07.0953535+05:30"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/started"), - // DisplayStatus: to.Ptr("Started"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-12T16:50:07.0953535+05:30"); return t}()), - // }, - // { - // Code: to.Ptr("CurrentUpgradeDomain/-1"), - // DisplayStatus: to.Ptr("Current Upgrade Domain of cloud service is -1."), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("MaxUpgradeDomain/1"), - // DisplayStatus: to.Ptr("Max Upgrade Domain of cloud service is 1."), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServicesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CloudServiceListResult = armcompute.CloudServiceListResult{ - // Value: []*armcompute.CloudService{ - // { - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // Settings: "userazure01/12/2022 16:29:02", - // 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"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServicesClient().NewListPager("ConstosoRG", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CloudServiceListResult = armcompute.CloudServiceListResult{ - // Value: []*armcompute.CloudService{ - // { - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // Settings: "userazure01/12/2022 16:29:02", - // 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"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().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 d97c77acd9bb..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go +++ /dev/null @@ -1,99 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesUpdateDomainClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServicesUpdateDomainClient().GetUpdateDomain(ctx, "ConstosoRG", "{cs-name}", 1, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UpdateDomain = armcompute.UpdateDomain{ - // Name: to.Ptr("1"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/1"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServicesUpdateDomainClient().NewListUpdateDomainsPager("ConstosoRG", "{cs-name}", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UpdateDomainListResult = armcompute.UpdateDomainListResult{ - // Value: []*armcompute.UpdateDomain{ - // { - // Name: to.Ptr("0"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/0"), - // }, - // { - // Name: to.Ptr("1"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/1"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleries_client.go b/sdk/resourcemanager/compute/armcompute/communitygalleries_client.go index 4c0a55f739bb..3e544797bc7a 100644 --- a/sdk/resourcemanager/compute/armcompute/communitygalleries_client.go +++ b/sdk/resourcemanager/compute/armcompute/communitygalleries_client.go @@ -48,7 +48,7 @@ func NewCommunityGalleriesClient(subscriptionID string, credential azcore.TokenC // Get - Get a community gallery by gallery public name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - publicGalleryName - The public name of the community gallery. // - options - CommunityGalleriesClientGetOptions contains the optional parameters for the CommunityGalleriesClient.Get method. @@ -87,7 +87,7 @@ func (client *CommunityGalleriesClient) getCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 5dc0a3d0c403..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go +++ /dev/null @@ -1,46 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCommunityGalleriesClient().Get(ctx, "myLocation", "publicGalleryName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommunityGallery = armcompute.CommunityGallery{ - // Name: to.Ptr("publicGalleryName"), - // Type: to.Ptr("Microsoft.Compute/Locations/CommunityGallery"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName"), - // }, - // Location: to.Ptr("myLocation"), - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client.go index 23b341df2089..3d2868fc709f 100644 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client.go @@ -48,7 +48,7 @@ func NewCommunityGalleryImagesClient(subscriptionID string, credential azcore.To // Get - Get a community gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - publicGalleryName - The public name of the community gallery. // - galleryImageName - The name of the community gallery image definition. @@ -93,7 +93,7 @@ func (client *CommunityGalleryImagesClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,7 +110,7 @@ func (client *CommunityGalleryImagesClient) getHandleResponse(resp *http.Respons // NewListPager - List community gallery images inside a gallery. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - publicGalleryName - The public name of the community gallery. // - options - CommunityGalleryImagesClientListOptions contains the optional parameters for the CommunityGalleryImagesClient.NewListPager @@ -163,7 +163,7 @@ func (client *CommunityGalleryImagesClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 fbb2a852a0c7..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCommunityGalleryImagesClient().Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommunityGalleryImage = armcompute.CommunityGalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // Type: to.Ptr("Microsoft.Compute/Locations/CommunityGalleryImage"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageProperties{ - // Eula: to.Ptr("https://www.microsoft.com/en-us/"), - // 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), - // PrivacyStatementURI: to.Ptr("https://www.microsoft.com/en-us/"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCommunityGalleryImagesClient().NewListPager("myLocation", "publicGalleryName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CommunityGalleryImageList = armcompute.CommunityGalleryImageList{ - // Value: []*armcompute.CommunityGalleryImage{ - // { - // Name: to.Ptr("myGalleryImageName"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageProperties{ - // 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), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client.go index a05c5d729ce0..531506dce166 100644 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client.go @@ -48,7 +48,7 @@ func NewCommunityGalleryImageVersionsClient(subscriptionID string, credential az // Get - Get a community gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - publicGalleryName - The public name of the community gallery. // - galleryImageName - The name of the community gallery image definition. @@ -100,7 +100,7 @@ func (client *CommunityGalleryImageVersionsClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +117,7 @@ func (client *CommunityGalleryImageVersionsClient) getHandleResponse(resp *http. // NewListPager - List community gallery image versions inside an image. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - publicGalleryName - The public name of the community gallery. // - galleryImageName - The name of the community gallery image definition. @@ -175,7 +175,7 @@ func (client *CommunityGalleryImageVersionsClient) listCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 0b584eb34234..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCommunityGalleryImageVersionsClient().Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", "myGalleryImageVersionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommunityGalleryImageVersion = armcompute.CommunityGalleryImageVersion{ - // Name: to.Ptr("myGalleryImageVersionName"), - // Type: to.Ptr("Microsoft.Compute/Locations/CommunityGalleryImageVersion"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageVersionProperties{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCommunityGalleryImageVersionsClient().NewListPager("myLocation", "publicGalleryName", "myGalleryImageName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CommunityGalleryImageVersionList = armcompute.CommunityGalleryImageVersionList{ - // Value: []*armcompute.CommunityGalleryImageVersion{ - // { - // Name: to.Ptr("myGalleryImageVersionName"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageVersionProperties{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/computerpcommon_live_test.go b/sdk/resourcemanager/compute/armcompute/computerpcommon_live_test.go deleted file mode 100644 index 77ebfe856aca..000000000000 --- a/sdk/resourcemanager/compute/armcompute/computerpcommon_live_test.go +++ /dev/null @@ -1,100 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type ComputeRpCommonTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *ComputeRpCommonTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *ComputeRpCommonTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestComputeRpCommonTestSuite(t *testing.T) { - suite.Run(t, new(ComputeRpCommonTestSuite)) -} - -// Microsoft.Compute/operations -func (testsuite *ComputeRpCommonTestSuite) TestOperations() { - var err error - // From step Operations_List - fmt.Println("Call operation: Operations_List") - operationsClient, err := armcompute.NewOperationsClient(testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - operationsClientNewListPager := operationsClient.NewListPager(nil) - for operationsClientNewListPager.More() { - _, err := operationsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } -} - -// Microsoft.Compute/locations/{location}/usages -func (testsuite *ComputeRpCommonTestSuite) TestUsage() { - var err error - // From step Usage_List - fmt.Println("Call operation: Usage_List") - usageClient, err := armcompute.NewUsageClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - usageClientNewListPager := usageClient.NewListPager(testsuite.location, nil) - for usageClientNewListPager.More() { - _, err := usageClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } -} - -// Microsoft.Compute/locations/{location}/vmSizes -func (testsuite *ComputeRpCommonTestSuite) TestVirtualMachineSizes() { - var err error - // From step VirtualMachineSizes_List - fmt.Println("Call operation: VirtualMachineSizes_List") - virtualMachineSizesClient, err := armcompute.NewVirtualMachineSizesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachineSizesClientNewListPager := virtualMachineSizesClient.NewListPager(testsuite.location, nil) - for virtualMachineSizesClientNewListPager.More() { - _, err := virtualMachineSizesClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } -} diff --git a/sdk/resourcemanager/compute/armcompute/constants.go b/sdk/resourcemanager/compute/armcompute/constants.go index 930294357692..6e29e64bd185 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.2.1" + moduleVersion = "v5.0.0" ) type AccessLevel string @@ -69,7 +69,7 @@ func PossibleAlternativeTypeValues() []AlternativeType { } } -// Architecture - The architecture of the image. Applicable to OS disks only. +// Architecture - CPU architecture supported by an OS disk. type Architecture string const ( @@ -1146,10 +1146,7 @@ func PossibleOperatingSystemTypeValues() []OperatingSystemType { } } -// OperatingSystemTypes - This property allows you to specify the supported type of the OS that application is built for. -// Possible values are: -// Windows -// Linux +// OperatingSystemTypes - The Operating System type. type OperatingSystemTypes string const ( diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhost_live_test.go b/sdk/resourcemanager/compute/armcompute/dedicatedhost_live_test.go deleted file mode 100644 index 8852d1a2e308..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhost_live_test.go +++ /dev/null @@ -1,174 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type DedicatedHostTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - hostGroupName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *DedicatedHostTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.hostGroupName = testutil.GenerateAlphaNumericID(testsuite.T(), "hostgroupn", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *DedicatedHostTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestDedicatedHostTestSuite(t *testing.T) { - suite.Run(t, new(DedicatedHostTestSuite)) -} - -func (testsuite *DedicatedHostTestSuite) Prepare() { - var err error - // From step DedicatedHostGroups_CreateOrUpdate - fmt.Println("Call operation: DedicatedHostGroups_CreateOrUpdate") - dedicatedHostGroupsClient, err := armcompute.NewDedicatedHostGroupsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = dedicatedHostGroupsClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.hostGroupName, armcompute.DedicatedHostGroup{ - Location: to.Ptr(testsuite.location), - 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) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/hostGroups -func (testsuite *DedicatedHostTestSuite) TestDedicatedHostGroups() { - var err error - // From step DedicatedHostGroups_ListBySubscription - fmt.Println("Call operation: DedicatedHostGroups_ListBySubscription") - dedicatedHostGroupsClient, err := armcompute.NewDedicatedHostGroupsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - dedicatedHostGroupsClientNewListBySubscriptionPager := dedicatedHostGroupsClient.NewListBySubscriptionPager(nil) - for dedicatedHostGroupsClientNewListBySubscriptionPager.More() { - _, err := dedicatedHostGroupsClientNewListBySubscriptionPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DedicatedHostGroups_ListByResourceGroup - fmt.Println("Call operation: DedicatedHostGroups_ListByResourceGroup") - dedicatedHostGroupsClientNewListByResourceGroupPager := dedicatedHostGroupsClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for dedicatedHostGroupsClientNewListByResourceGroupPager.More() { - _, err := dedicatedHostGroupsClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DedicatedHostGroups_Get - fmt.Println("Call operation: DedicatedHostGroups_Get") - _, err = dedicatedHostGroupsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.hostGroupName, &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil}) - testsuite.Require().NoError(err) - - // From step DedicatedHostGroups_Update - fmt.Println("Call operation: DedicatedHostGroups_Update") - _, err = dedicatedHostGroupsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.hostGroupName, armcompute.DedicatedHostGroupUpdate{}, nil) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/hostGroups/hosts -func (testsuite *DedicatedHostTestSuite) TestDedicatedHosts() { - hostName := testutil.GenerateAlphaNumericID(testsuite.T(), "hostname", 6) - var err error - // From step DedicatedHosts_CreateOrUpdate - fmt.Println("Call operation: DedicatedHosts_CreateOrUpdate") - dedicatedHostsClient, err := armcompute.NewDedicatedHostsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - dedicatedHostsClientCreateOrUpdateResponsePoller, err := dedicatedHostsClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.hostGroupName, hostName, armcompute.DedicatedHost{ - Location: to.Ptr(testsuite.location), - 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) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, dedicatedHostsClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step DedicatedHosts_ListByHostGroup - fmt.Println("Call operation: DedicatedHosts_ListByHostGroup") - dedicatedHostsClientNewListByHostGroupPager := dedicatedHostsClient.NewListByHostGroupPager(testsuite.resourceGroupName, testsuite.hostGroupName, nil) - for dedicatedHostsClientNewListByHostGroupPager.More() { - _, err := dedicatedHostsClientNewListByHostGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DedicatedHosts_Get - fmt.Println("Call operation: DedicatedHosts_Get") - _, err = dedicatedHostsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.hostGroupName, hostName, &armcompute.DedicatedHostsClientGetOptions{Expand: nil}) - testsuite.Require().NoError(err) - - // From step DedicatedHosts_Update - fmt.Println("Call operation: DedicatedHosts_Update") - dedicatedHostsClientUpdateResponsePoller, err := dedicatedHostsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.hostGroupName, hostName, armcompute.DedicatedHostUpdate{}, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, dedicatedHostsClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step DedicatedHosts_Restart - fmt.Println("Call operation: DedicatedHosts_Restart") - dedicatedHostsClientRestartResponsePoller, err := dedicatedHostsClient.BeginRestart(testsuite.ctx, testsuite.resourceGroupName, testsuite.hostGroupName, hostName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, dedicatedHostsClientRestartResponsePoller) - testsuite.Require().NoError(err) - - // From step DedicatedHosts_Delete - fmt.Println("Call operation: DedicatedHosts_Delete") - dedicatedHostsClientDeleteResponsePoller, err := dedicatedHostsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.hostGroupName, hostName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, dedicatedHostsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} 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 e8e22e6c315a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go +++ /dev/null @@ -1,616 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("finance"), - // "owner": to.Ptr("myCompany"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{ - // UltraSSDEnabled: to.Ptr(true), - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("finance"), - // "owner": to.Ptr("myCompany"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("aaaa"), - // 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}()), - // }}, - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.DedicatedHostGroupUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDedicatedHostGroupsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDedicatedHostGroupsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost2"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // Name: to.Ptr("myHost1"), - // }, - // { - // AssetID: to.Ptr("f293d4ac-5eea-4be2-b0c0-0fcaa09aebf8"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // Name: to.Ptr("myHost2"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{ - // UltraSSDEnabled: to.Ptr(true), - // }, - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // Name: to.Ptr("myHost"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // Name: to.Ptr("myDedicatedHostGroup"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("aaaa"), - // 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}()), - // }}, - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // Name: to.Ptr("myDedicatedHostGroup"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("aaaa"), - // 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}()), - // }}, - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} 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 0b1da4383a60..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go +++ /dev/null @@ -1,425 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Name: to.Ptr("myDedicatedHost"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(false), - // HostID: to.Ptr("{GUID}"), - // LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid), - // PlatformFaultDomain: to.Ptr[int32](1), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Name: to.Ptr("myDedicatedHost"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(true), - // HostID: to.Ptr("{GUID}"), - // InstanceView: &armcompute.DedicatedHostInstanceView{ - // AssetID: to.Ptr("aaaaaaaaaaaaaaaa"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()), - // VirtualMachines: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // Capacity: to.Ptr[int64](7), - // Tier: to.Ptr("aaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Location: to.Ptr("westus"), - // SKU: &armcompute.SKU{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", &armcompute.DedicatedHostsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Name: to.Ptr("myHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(true), - // HostID: to.Ptr("{GUID}"), - // InstanceView: &armcompute.DedicatedHostInstanceView{ - // AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // }, - // PlatformFaultDomain: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-27T01:02:38.3138469+00:00"); return t}()), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-27T01:02:38.3138469+00:00"); return t}()), - // VirtualMachines: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/vm1"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostsClient().NewListByHostGroupPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostListResult = armcompute.DedicatedHostListResult{ - // Value: []*armcompute.DedicatedHost{ - // { - // Name: to.Ptr("myDedicatedHost"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(true), - // HostID: to.Ptr("{GUID}"), - // InstanceView: &armcompute.DedicatedHostInstanceView{ - // AssetID: to.Ptr("aaaaaaaaaaaaaaaa"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()), - // VirtualMachines: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // Capacity: to.Ptr[int64](7), - // Tier: to.Ptr("aaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostsClient().NewListByHostGroupPager("rgcompute", "aaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostListResult = armcompute.DedicatedHostListResult{ - // Value: []*armcompute.DedicatedHost{ - // { - // Location: to.Ptr("westus"), - // SKU: &armcompute.SKU{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().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/disk_live_test.go b/sdk/resourcemanager/compute/armcompute/disk_live_test.go deleted file mode 100644 index bedc48da779c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/disk_live_test.go +++ /dev/null @@ -1,137 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type DiskTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - diskName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *DiskTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.diskName = testutil.GenerateAlphaNumericID(testsuite.T(), "diskname", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *DiskTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestDiskTestSuite(t *testing.T) { - suite.Run(t, new(DiskTestSuite)) -} - -// Microsoft.Compute/disks/{diskName} -func (testsuite *DiskTestSuite) TestDisks() { - var err error - // From step Disks_CreateOrUpdate - fmt.Println("Call operation: Disks_CreateOrUpdate") - disksClient, err := armcompute.NewDisksClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - disksClientCreateOrUpdateResponsePoller, err := disksClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskName, armcompute.Disk{ - Location: to.Ptr(testsuite.location), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, disksClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step Disks_List - fmt.Println("Call operation: Disks_List") - disksClientNewListPager := disksClient.NewListPager(nil) - for disksClientNewListPager.More() { - _, err := disksClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Disks_ListByResourceGroup - fmt.Println("Call operation: Disks_ListByResourceGroup") - disksClientNewListByResourceGroupPager := disksClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for disksClientNewListByResourceGroupPager.More() { - _, err := disksClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Disks_Get - fmt.Println("Call operation: Disks_Get") - _, err = disksClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskName, nil) - testsuite.Require().NoError(err) - - // From step Disks_Update - fmt.Println("Call operation: Disks_Update") - disksClientUpdateResponsePoller, err := disksClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskName, armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, disksClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step Disks_GrantAccess - fmt.Println("Call operation: Disks_GrantAccess") - disksClientGrantAccessResponsePoller, err := disksClient.BeginGrantAccess(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskName, armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, disksClientGrantAccessResponsePoller) - testsuite.Require().NoError(err) - - // From step Disks_RevokeAccess - fmt.Println("Call operation: Disks_RevokeAccess") - disksClientRevokeAccessResponsePoller, err := disksClient.BeginRevokeAccess(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, disksClientRevokeAccessResponsePoller) - testsuite.Require().NoError(err) - - // From step Disks_Delete - fmt.Println("Call operation: Disks_Delete") - disksClientDeleteResponsePoller, err := disksClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, disksClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} diff --git a/sdk/resourcemanager/compute/armcompute/diskaccess_live_test.go b/sdk/resourcemanager/compute/armcompute/diskaccess_live_test.go deleted file mode 100644 index 8819fc58dd5c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskaccess_live_test.go +++ /dev/null @@ -1,129 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type DiskAccessTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - diskAccessName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *DiskAccessTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.diskAccessName = testutil.GenerateAlphaNumericID(testsuite.T(), "diskaccess", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *DiskAccessTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestDiskAccessTestSuite(t *testing.T) { - suite.Run(t, new(DiskAccessTestSuite)) -} - -// Microsoft.Compute/diskAccesses/{diskAccessName} -func (testsuite *DiskAccessTestSuite) TestDiskAccesses() { - var err error - // From step DiskAccesses_CreateOrUpdate - fmt.Println("Call operation: DiskAccesses_CreateOrUpdate") - diskAccessesClient, err := armcompute.NewDiskAccessesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - diskAccessesClientCreateOrUpdateResponsePoller, err := diskAccessesClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskAccessName, armcompute.DiskAccess{ - Location: to.Ptr(testsuite.location), - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, diskAccessesClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step DiskAccesses_List - fmt.Println("Call operation: DiskAccesses_List") - diskAccessesClientNewListPager := diskAccessesClient.NewListPager(nil) - for diskAccessesClientNewListPager.More() { - _, err := diskAccessesClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DiskAccesses_ListPrivateEndpointConnections - fmt.Println("Call operation: DiskAccesses_ListPrivateEndpointConnections") - diskAccessesClientNewListPrivateEndpointConnectionsPager := diskAccessesClient.NewListPrivateEndpointConnectionsPager(testsuite.resourceGroupName, testsuite.diskAccessName, nil) - for diskAccessesClientNewListPrivateEndpointConnectionsPager.More() { - _, err := diskAccessesClientNewListPrivateEndpointConnectionsPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DiskAccesses_GetPrivateLinkResources - fmt.Println("Call operation: DiskAccesses_GetPrivateLinkResources") - _, err = diskAccessesClient.GetPrivateLinkResources(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskAccessName, nil) - testsuite.Require().NoError(err) - - // From step DiskAccesses_ListByResourceGroup - fmt.Println("Call operation: DiskAccesses_ListByResourceGroup") - diskAccessesClientNewListByResourceGroupPager := diskAccessesClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for diskAccessesClientNewListByResourceGroupPager.More() { - _, err := diskAccessesClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DiskAccesses_Get - fmt.Println("Call operation: DiskAccesses_Get") - _, err = diskAccessesClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskAccessName, nil) - testsuite.Require().NoError(err) - - // From step DiskAccesses_Update - fmt.Println("Call operation: DiskAccesses_Update") - diskAccessesClientUpdateResponsePoller, err := diskAccessesClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskAccessName, armcompute.DiskAccessUpdate{ - Tags: map[string]*string{ - "department": to.Ptr("Development"), - "project": to.Ptr("PrivateEndpoints"), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, diskAccessesClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step DiskAccesses_Delete - fmt.Println("Call operation: DiskAccesses_Delete") - diskAccessesClientDeleteResponsePoller, err := diskAccessesClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.diskAccessName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, diskAccessesClientDeleteResponsePoller) - testsuite.Require().NoError(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 4432a81a6c30..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go +++ /dev/null @@ -1,529 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourcegroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourcegroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().Get(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().Get(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskAccessesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskAccessList = armcompute.DiskAccessList{ - // Value: []*armcompute.DiskAccess{ - // { - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myDiskAccess2"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2/privateEndpoinConnections/myDiskAccess2.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint2"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskAccessesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskAccessList = armcompute.DiskAccessList{ - // Value: []*armcompute.DiskAccess{ - // { - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myDiskAccess2"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2/privateEndpoinConnections/myDiskAccess2.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint2"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().GetPrivateLinkResources(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResourceListResult = armcompute.PrivateLinkResourceListResult{ - // Value: []*armcompute.PrivateLinkResource{ - // { - // Name: to.Ptr("disks"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/privateLinkResources"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateLinkResources/disks"), - // Properties: &armcompute.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("disks"), - // RequiredMembers: []*string{ - // to.Ptr("diskAccess_1")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armcompute.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnectionName"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnectionName"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approving myPrivateEndpointConnection"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().GetAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armcompute.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnection"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskAccessesClient().NewListPrivateEndpointConnectionsPager("myResourceGroup", "myDiskAccess", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armcompute.PrivateEndpointConnectionListResult{ - // Value: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnection"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} 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 4875c39823c6..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go +++ /dev/null @@ -1,657 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // 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), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // 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}": &armcompute.UserAssignedIdentitiesValue{ - // }, - // }, - // }, - // 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"), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // 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), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // 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/keyName/KeyVersion2"), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079872+00:00"); return t}()), - // ProvisioningState: to.Ptr("Succeeded"), - // RotationToLatestKeyVersionEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // 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/keyName/keyVersion2"), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079872+00:00"); return t}()), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // { - // KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RotationToLatestKeyVersionEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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/keyName/keyVersion"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079872+00:00"); return t}()), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskEncryptionSetsClient().Get(ctx, "myResourceGroup", "myDiskEncryptionSet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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"), - // }, - // }, - // AutoKeyRotationError: &armcompute.APIError{ - // Code: to.Ptr("ManagedServiceIdentityNotFound"), - // Message: to.Ptr("Auto-key rotation was disabled as managed service identity associated with DiskEncryptionSet 'myDiskEncryptionSet' was not found. Please update the resource with correct identity to re-enable auto-key rotation."), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RotationToLatestKeyVersionEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskEncryptionSetsClient().Get(ctx, "myResourceGroup", "myDiskEncryptionSet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskEncryptionSetsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskEncryptionSetList = armcompute.DiskEncryptionSetList{ - // Value: []*armcompute.DiskEncryptionSet{ - // { - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("myDiskEncryptionSet2"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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/myVMVault2"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskEncryptionSetsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskEncryptionSetList = armcompute.DiskEncryptionSetList{ - // Value: []*armcompute.DiskEncryptionSet{ - // { - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("myDiskEncryptionSet2"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // 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/mySecondResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault2"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskEncryptionSetsClient().NewListAssociatedResourcesPager("myResourceGroup", "myDiskEncryptionSet", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceURIList = armcompute.ResourceURIList{ - // Value: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")}, - // } - } -} 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 482181ef1b17..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go +++ /dev/null @@ -1,183 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskRestorePointClient().Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskRestorePoint = armcompute.DiskRestorePoint{ - // Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // Properties: &armcompute.DiskRestorePointProperties{ - // FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled), - // SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"), - // SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskRestorePointClient().Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskRestorePoint = armcompute.DiskRestorePoint{ - // Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // Properties: &armcompute.DiskRestorePointProperties{ - // CompletionPercent: to.Ptr[float32](100), - // FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled), - // ReplicationState: to.Ptr("Succeeded"), - // SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"), - // SourceResourceLocation: to.Ptr("eastus2"), - // SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskRestorePointClient().NewListByRestorePointPager("myResourceGroup", "rpc", "vmrp", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskRestorePointList = armcompute.DiskRestorePointList{ - // Value: []*armcompute.DiskRestorePoint{ - // { - // Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // Properties: &armcompute.DiskRestorePointProperties{ - // FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled), - // SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"), - // SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079872+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskRestorePointClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskRestorePointClient().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 f4a335f7cb2e..000000000000 --- a/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go +++ /dev/null @@ -1,2115 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecureVMDiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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}"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("{sku}"), - // Product: to.Ptr("{offer}"), - // Publisher: to.Ptr("{publisher}"), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk2"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload), - // PerformancePlus: to.Ptr(true), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myPremiumV2Disk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumV2LRS), - // Tier: to.Ptr("Premium"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumZRS), - // Tier: to.Ptr("Premium"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myUltraReadOnlyDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS), - // Tier: to.Ptr("Ultra"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload), - // UploadSizeBytes: to.Ptr[int64](10737418752), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // 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), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS), - // Tier: to.Ptr("Ultra"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // BurstingEnabled: to.Ptr(true), - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](1024), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(false), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // Architecture: to.Ptr(armcompute.ArchitectureArm64), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("myPurchasePlanName"), - // Product: to.Ptr("myPurchasePlanProduct"), - // PromotionCode: to.Ptr("myPurchasePlanPromotionCode"), - // Publisher: to.Ptr("myPurchasePlanPublisher"), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - // SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportsHibernation: to.Ptr(true), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Tier: to.Ptr("P30"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // OptimizedForFrequentAttach: to.Ptr(false), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/marketplacetestfirstparty/ArtifactTypes/VMImage/Offers/nvme_test_062/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // DiskControllerTypes: to.Ptr("SCSI"), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDisksClient().Get(ctx, "myResourceGroup", "myManagedDisk", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myManagedDisk"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // ManagedBy: to.Ptr("/subscriptions/123caaa-123v-v211-a49f-f88ccac5bf88/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/virtualMachines/TestVM414689371c88843d65ec"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](10), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("test_sku"), - // Product: to.Ptr("marketplace_vm_test"), - // Publisher: to.Ptr("test_test_pmc2pc1"), - // }, - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // SupportsHibernation: to.Ptr(true), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079872+00:00"); return t}()), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDisksClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskList = armcompute.DiskList{ - // Value: []*armcompute.Disk{ - // { - // Name: to.Ptr("myManagedDisk1"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.9278721+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk2"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](10), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.872242+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk3"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // 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}"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.3973934+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDisksClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskList = armcompute.DiskList{ - // Value: []*armcompute.Disk{ - // { - // Name: to.Ptr("myManagedDisk1"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.9278721+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk2"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](10), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.872242+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk3"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk3"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // 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}"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.3973934+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // SecurityDataAccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/b9bf5824-6122-49e0-ba22-042f76ccd8a1_vmgs?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().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.go b/sdk/resourcemanager/compute/armcompute/galleries_client.go index 1faff1f6cd33..6c157d9438df 100644 --- a/sdk/resourcemanager/compute/armcompute/galleries_client.go +++ b/sdk/resourcemanager/compute/armcompute/galleries_client.go @@ -48,7 +48,7 @@ func NewGalleriesClient(subscriptionID string, credential azcore.TokenCredential // BeginCreateOrUpdate - Create or update a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with dots and periods // allowed in the middle. The maximum length is 80 characters. @@ -70,7 +70,7 @@ func (client *GalleriesClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Create or update a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleriesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, gallery, options) if err != nil { @@ -106,7 +106,7 @@ func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, gallery) @@ -115,7 +115,7 @@ func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Delete a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery to be deleted. // - options - GalleriesClientBeginDeleteOptions contains the optional parameters for the GalleriesClient.BeginDelete method. @@ -134,7 +134,7 @@ func (client *GalleriesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Delete a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleriesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, options) if err != nil { @@ -170,7 +170,7 @@ func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,7 +179,7 @@ func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resource // Get - Retrieves information about a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery. // - options - GalleriesClientGetOptions contains the optional parameters for the GalleriesClient.Get method. @@ -218,7 +218,7 @@ func (client *GalleriesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") if options != nil && options.Select != nil { reqQP.Set("$select", string(*options.Select)) } @@ -241,7 +241,7 @@ func (client *GalleriesClient) getHandleResponse(resp *http.Response) (Galleries // NewListPager - List galleries under a subscription. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - options - GalleriesClientListOptions contains the optional parameters for the GalleriesClient.NewListPager method. func (client *GalleriesClient) NewListPager(options *GalleriesClientListOptions) *runtime.Pager[GalleriesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[GalleriesClientListResponse]{ @@ -283,7 +283,7 @@ func (client *GalleriesClient) listCreateRequest(ctx context.Context, options *G return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,7 +300,7 @@ func (client *GalleriesClient) listHandleResponse(resp *http.Response) (Gallerie // NewListByResourceGroupPager - List galleries under a resource group. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - options - GalleriesClientListByResourceGroupOptions contains the optional parameters for the GalleriesClient.NewListByResourceGroupPager // method. @@ -348,7 +348,7 @@ func (client *GalleriesClient) listByResourceGroupCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -366,7 +366,7 @@ func (client *GalleriesClient) listByResourceGroupHandleResponse(resp *http.Resp // BeginUpdate - Update a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with dots and periods // allowed in the middle. The maximum length is 80 characters. @@ -387,7 +387,7 @@ func (client *GalleriesClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Update a Shared Image Gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleriesClient) update(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, gallery, options) if err != nil { @@ -423,7 +423,7 @@ func (client *GalleriesClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, gallery) 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 913b1ce36fe2..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go +++ /dev/null @@ -1,521 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // SharingProfile: &armcompute.SharingProfile{ - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // SoftDeletePolicy: &armcompute.SoftDeletePolicy{ - // IsSoftDeleteEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // SharingProfile: &armcompute.SharingProfile{ - // CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{ - // CommunityGalleryEnabled: to.Ptr(true), - // Eula: to.Ptr("eula"), - // PublicNames: []*string{ - // to.Ptr("GalelryPublicName")}, - // PublisherContact: to.Ptr("pir@microsoft.com"), - // PublisherURI: to.Ptr("uri"), - // }, - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity), - // }, - // SharingStatus: &armcompute.SharingStatus{ - // AggregatedState: to.Ptr(armcompute.SharingStateSucceeded), - // Summary: []*armcompute.RegionalSharingStatus{ - // { - // Region: to.Ptr("westus"), - // State: to.Ptr(armcompute.SharingStateSucceeded), - // Details: to.Ptr(""), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // SharingProfile: &armcompute.SharingProfile{ - // 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")}, - // }}, - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // SharingProfile: &armcompute.SharingProfile{ - // 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")}, - // }}, - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleriesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryList = armcompute.GalleryList{ - // Value: []*armcompute.Gallery{ - // { - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleriesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryList = armcompute.GalleryList{ - // Value: []*armcompute.Gallery{ - // { - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/gallery_live_test.go b/sdk/resourcemanager/compute/armcompute/gallery_live_test.go deleted file mode 100644 index a62b519b428b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/gallery_live_test.go +++ /dev/null @@ -1,265 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type GalleryTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - galleryApplicationName string - galleryImageName string - galleryName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *GalleryTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.galleryApplicationName = testutil.GenerateAlphaNumericID(testsuite.T(), "galleryapp", 6) - testsuite.galleryImageName = testutil.GenerateAlphaNumericID(testsuite.T(), "galleryima", 6) - testsuite.galleryName = testutil.GenerateAlphaNumericID(testsuite.T(), "gallerynam", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *GalleryTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestGalleryTestSuite(t *testing.T) { - suite.Run(t, new(GalleryTestSuite)) -} - -func (testsuite *GalleryTestSuite) Prepare() { - var err error - // From step Galleries_CreateOrUpdate - fmt.Println("Call operation: Galleries_CreateOrUpdate") - galleriesClient, err := armcompute.NewGalleriesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - galleriesClientCreateOrUpdateResponsePoller, err := galleriesClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, armcompute.Gallery{ - Location: to.Ptr(testsuite.location), - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, galleriesClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/galleries/{galleryName} -func (testsuite *GalleryTestSuite) TestGalleries() { - var err error - // From step Galleries_List - fmt.Println("Call operation: Galleries_List") - galleriesClient, err := armcompute.NewGalleriesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - galleriesClientNewListPager := galleriesClient.NewListPager(nil) - for galleriesClientNewListPager.More() { - _, err := galleriesClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Galleries_ListByResourceGroup - fmt.Println("Call operation: Galleries_ListByResourceGroup") - galleriesClientNewListByResourceGroupPager := galleriesClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for galleriesClientNewListByResourceGroupPager.More() { - _, err := galleriesClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Galleries_Get - fmt.Println("Call operation: Galleries_Get") - _, err = galleriesClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: nil, - }) - testsuite.Require().NoError(err) - - // From step Galleries_Update - fmt.Println("Call operation: Galleries_Update") - galleriesClientUpdateResponsePoller, err := galleriesClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, armcompute.GalleryUpdate{ - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, galleriesClientUpdateResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName} -func (testsuite *GalleryTestSuite) TestGalleryImages() { - var err error - // From step GalleryImages_CreateOrUpdate - fmt.Println("Call operation: GalleryImages_CreateOrUpdate") - galleryImagesClient, err := armcompute.NewGalleryImagesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - galleryImagesClientCreateOrUpdateResponsePoller, err := galleryImagesClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, testsuite.galleryImageName, armcompute.GalleryImage{ - Location: to.Ptr(testsuite.location), - 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) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, galleryImagesClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step GalleryImages_ListByGallery - fmt.Println("Call operation: GalleryImages_ListByGallery") - galleryImagesClientNewListByGalleryPager := galleryImagesClient.NewListByGalleryPager(testsuite.resourceGroupName, testsuite.galleryName, nil) - for galleryImagesClientNewListByGalleryPager.More() { - _, err := galleryImagesClientNewListByGalleryPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step GalleryImages_Get - fmt.Println("Call operation: GalleryImages_Get") - _, err = galleryImagesClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, testsuite.galleryImageName, nil) - testsuite.Require().NoError(err) - - // From step GalleryImages_Update - fmt.Println("Call operation: GalleryImages_Update") - galleryImagesClientUpdateResponsePoller, err := galleryImagesClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, testsuite.galleryImageName, armcompute.GalleryImageUpdate{ - Tags: map[string]*string{ - "0": to.Ptr("[object Object]"), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, galleryImagesClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step GalleryImages_Delete - fmt.Println("Call operation: GalleryImages_Delete") - galleryImagesClientDeleteResponsePoller, err := galleryImagesClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, testsuite.galleryImageName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, galleryImagesClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName} -func (testsuite *GalleryTestSuite) TestGalleryApplications() { - var err error - // From step GalleryApplications_CreateOrUpdate - fmt.Println("Call operation: GalleryApplications_CreateOrUpdate") - galleryApplicationsClient, err := armcompute.NewGalleryApplicationsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - galleryApplicationsClientCreateOrUpdateResponsePoller, err := galleryApplicationsClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, testsuite.galleryApplicationName, armcompute.GalleryApplication{ - Location: to.Ptr(testsuite.location), - 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) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, galleryApplicationsClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step GalleryApplications_ListByGallery - fmt.Println("Call operation: GalleryApplications_ListByGallery") - galleryApplicationsClientNewListByGalleryPager := galleryApplicationsClient.NewListByGalleryPager(testsuite.resourceGroupName, testsuite.galleryName, nil) - for galleryApplicationsClientNewListByGalleryPager.More() { - _, err := galleryApplicationsClientNewListByGalleryPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step GalleryApplications_Get - fmt.Println("Call operation: GalleryApplications_Get") - _, err = galleryApplicationsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, testsuite.galleryApplicationName, nil) - testsuite.Require().NoError(err) - - // From step GalleryApplications_Update - fmt.Println("Call operation: GalleryApplications_Update") - galleryApplicationsClientUpdateResponsePoller, err := galleryApplicationsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, testsuite.galleryApplicationName, 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) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, galleryApplicationsClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step GalleryApplications_Delete - fmt.Println("Call operation: GalleryApplications_Delete") - galleryApplicationsClientDeleteResponsePoller, err := galleryApplicationsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.galleryName, testsuite.galleryApplicationName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, galleryApplicationsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryapplications_client.go b/sdk/resourcemanager/compute/armcompute/galleryapplications_client.go index 36ae2d7d969b..fe9dcf1ea670 100644 --- a/sdk/resourcemanager/compute/armcompute/galleryapplications_client.go +++ b/sdk/resourcemanager/compute/armcompute/galleryapplications_client.go @@ -48,7 +48,7 @@ func NewGalleryApplicationsClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Create or update a gallery Application Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition is to be created. // - galleryApplicationName - The name of the gallery Application Definition to be created or updated. The allowed characters @@ -72,7 +72,7 @@ func (client *GalleryApplicationsClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Create or update a gallery Application Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryApplicationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) if err != nil { @@ -112,7 +112,7 @@ func (client *GalleryApplicationsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, galleryApplication) @@ -121,7 +121,7 @@ func (client *GalleryApplicationsClient) createOrUpdateCreateRequest(ctx context // BeginDelete - Delete a gallery Application. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition is to be deleted. // - galleryApplicationName - The name of the gallery Application Definition to be deleted. @@ -142,7 +142,7 @@ func (client *GalleryApplicationsClient) BeginDelete(ctx context.Context, resour // Delete - Delete a gallery Application. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryApplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, options) if err != nil { @@ -182,7 +182,7 @@ func (client *GalleryApplicationsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ func (client *GalleryApplicationsClient) deleteCreateRequest(ctx context.Context // Get - Retrieves information about a gallery Application Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery from which the Application Definitions are to be retrieved. // - galleryApplicationName - The name of the gallery Application Definition to be retrieved. @@ -235,7 +235,7 @@ func (client *GalleryApplicationsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +252,7 @@ func (client *GalleryApplicationsClient) getHandleResponse(resp *http.Response) // NewListByGalleryPager - List gallery Application Definitions in a gallery. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery from which Application Definitions are to be listed. // - options - GalleryApplicationsClientListByGalleryOptions contains the optional parameters for the GalleryApplicationsClient.NewListByGalleryPager @@ -305,7 +305,7 @@ func (client *GalleryApplicationsClient) listByGalleryCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,7 +323,7 @@ func (client *GalleryApplicationsClient) listByGalleryHandleResponse(resp *http. // BeginUpdate - Update a gallery Application Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition is to be updated. // - galleryApplicationName - The name of the gallery Application Definition to be updated. The allowed characters are alphabets @@ -347,7 +347,7 @@ func (client *GalleryApplicationsClient) BeginUpdate(ctx context.Context, resour // Update - Update a gallery Application Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryApplicationsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) if err != nil { @@ -387,7 +387,7 @@ func (client *GalleryApplicationsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, galleryApplication) 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 a89242a2061d..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go +++ /dev/null @@ -1,285 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplication = armcompute.GalleryApplication{ - // Name: to.Ptr("myGalleryApplicationName"), - // Type: to.Ptr("Microsoft.Compute/galleries"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"), - // 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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplication = armcompute.GalleryApplication{ - // Name: to.Ptr("myGalleryApplicationName"), - // Type: to.Ptr("Microsoft.Compute/galleries"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"), - // 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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryApplicationsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplication = armcompute.GalleryApplication{ - // Name: to.Ptr("myGalleryApplicationName"), - // 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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryApplicationsClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryApplicationList = armcompute.GalleryApplicationList{ - // Value: []*armcompute.GalleryApplication{ - // { - // Name: to.Ptr("myGalleryApplicationName"), - // 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), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client.go b/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client.go index c9f3f47191d8..bbb8898c8f2d 100644 --- a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client.go @@ -48,7 +48,7 @@ func NewGalleryApplicationVersionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Create or update a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition resides. // - galleryApplicationName - The name of the gallery Application Definition in which the Application Version is to be created. @@ -73,7 +73,7 @@ func (client *GalleryApplicationVersionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Create or update a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryApplicationVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) if err != nil { @@ -117,7 +117,7 @@ func (client *GalleryApplicationVersionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, galleryApplicationVersion) @@ -126,7 +126,7 @@ func (client *GalleryApplicationVersionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition resides. // - galleryApplicationName - The name of the gallery Application Definition in which the Application Version resides. @@ -148,7 +148,7 @@ func (client *GalleryApplicationVersionsClient) BeginDelete(ctx context.Context, // Delete - Delete a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryApplicationVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, options) if err != nil { @@ -192,7 +192,7 @@ func (client *GalleryApplicationVersionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -201,7 +201,7 @@ func (client *GalleryApplicationVersionsClient) deleteCreateRequest(ctx context. // Get - Retrieves information about a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition resides. // - galleryApplicationName - The name of the gallery Application Definition in which the Application Version resides. @@ -254,7 +254,7 @@ func (client *GalleryApplicationVersionsClient) getCreateRequest(ctx context.Con if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -271,7 +271,7 @@ func (client *GalleryApplicationVersionsClient) getHandleResponse(resp *http.Res // NewListByGalleryApplicationPager - List gallery Application Versions in a gallery Application Definition. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition resides. // - galleryApplicationName - The name of the Shared Application Gallery Application Definition from which the Application Versions @@ -330,7 +330,7 @@ func (client *GalleryApplicationVersionsClient) listByGalleryApplicationCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -348,7 +348,7 @@ func (client *GalleryApplicationVersionsClient) listByGalleryApplicationHandleRe // BeginUpdate - Update a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Application Gallery in which the Application Definition resides. // - galleryApplicationName - The name of the gallery Application Definition in which the Application Version is to be updated. @@ -373,7 +373,7 @@ func (client *GalleryApplicationVersionsClient) BeginUpdate(ctx context.Context, // Update - Update a gallery Application Version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryApplicationVersionsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) if err != nil { @@ -417,7 +417,7 @@ func (client *GalleryApplicationVersionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, galleryApplicationVersion) 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 aebacdd761f8..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go +++ /dev/null @@ -1,473 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00+00:00"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.5972568+00:00"); 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), - // }}, - // AdvancedSettings: map[string]*string{ - // "timeout": to.Ptr("300"), - // "user": to.Ptr("root"), - // }, - // 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"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // ManageActions: &armcompute.UserArtifactManage{ - // Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - // Remove: to.Ptr("del C:\\package "), - // }, - // Settings: &armcompute.UserArtifactSettings{ - // ConfigFileName: to.Ptr("configuration.cfg"), - // PackageFileName: to.Ptr("package.zip"), - // }, - // Source: &armcompute.UserArtifactSource{ - // MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - // }, - // }, - // SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00+00:00"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.5972568+00:00"); 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), - // }}, - // EnableHealthCheck: to.Ptr(false), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryApplicationVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00+00:00"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.5972568+00:00"); 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), - // }}, - // AdvancedSettings: map[string]*string{ - // "timeout": to.Ptr("300"), - // "user": to.Ptr("root"), - // }, - // 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"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // ManageActions: &armcompute.UserArtifactManage{ - // Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - // Remove: to.Ptr("del C:\\package "), - // }, - // Settings: &armcompute.UserArtifactSettings{ - // ConfigFileName: to.Ptr("configuration.cfg"), - // PackageFileName: to.Ptr("package.zip"), - // }, - // Source: &armcompute.UserArtifactSource{ - // MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - // }, - // }, - // ReplicationStatus: &armcompute.ReplicationStatus{ - // AggregatedState: to.Ptr(armcompute.AggregatedReplicationStateCompleted), - // Summary: []*armcompute.RegionalReplicationStatus{ - // { - // Progress: to.Ptr[int32](100), - // Region: to.Ptr("West US"), - // State: to.Ptr(armcompute.ReplicationStateCompleted), - // Details: to.Ptr(""), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryApplicationVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", &armcompute.GalleryApplicationVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00+00:00"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.5972568+00:00"); 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"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationVersionsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryApplicationVersionsClient().NewListByGalleryApplicationPager("myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryApplicationVersionList = armcompute.GalleryApplicationVersionList{ - // Value: []*armcompute.GalleryApplicationVersion{ - // { - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00+00:00"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.5972568+00:00"); 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"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // 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), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryimages_client.go b/sdk/resourcemanager/compute/armcompute/galleryimages_client.go index bf4387227575..3823cdc8d0f7 100644 --- a/sdk/resourcemanager/compute/armcompute/galleryimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/galleryimages_client.go @@ -48,7 +48,7 @@ func NewGalleryImagesClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create or update a gallery image definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition is to be created. // - galleryImageName - The name of the gallery image definition to be created or updated. The allowed characters are alphabets @@ -72,7 +72,7 @@ func (client *GalleryImagesClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create or update a gallery image definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) if err != nil { @@ -112,7 +112,7 @@ func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, galleryImage) @@ -121,7 +121,7 @@ func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition is to be deleted. // - galleryImageName - The name of the gallery image definition to be deleted. @@ -142,7 +142,7 @@ func (client *GalleryImagesClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, options) if err != nil { @@ -182,7 +182,7 @@ func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, reso // Get - Retrieves information about a gallery image definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. // - galleryImageName - The name of the gallery image definition to be retrieved. @@ -235,7 +235,7 @@ func (client *GalleryImagesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +252,7 @@ func (client *GalleryImagesClient) getHandleResponse(resp *http.Response) (Galle // NewListByGalleryPager - List gallery image definitions in a gallery. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery from which Image Definitions are to be listed. // - options - GalleryImagesClientListByGalleryOptions contains the optional parameters for the GalleryImagesClient.NewListByGalleryPager @@ -305,7 +305,7 @@ func (client *GalleryImagesClient) listByGalleryCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,7 +323,7 @@ func (client *GalleryImagesClient) listByGalleryHandleResponse(resp *http.Respon // BeginUpdate - Update a gallery image definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition is to be updated. // - galleryImageName - The name of the gallery image definition to be updated. The allowed characters are alphabets and numbers @@ -346,7 +346,7 @@ func (client *GalleryImagesClient) BeginUpdate(ctx context.Context, resourceGrou // Update - Update a gallery image definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryImagesClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) if err != nil { @@ -386,7 +386,7 @@ func (client *GalleryImagesClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, galleryImage) 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 9782c9ae922a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go +++ /dev/null @@ -1,219 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImage = armcompute.GalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // 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), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImage = armcompute.GalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // 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), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImagesClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImage = armcompute.GalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // 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), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryImagesClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryImageList = armcompute.GalleryImageList{ - // Value: []*armcompute.GalleryImage{ - // { - // Name: to.Ptr("myGalleryImageName"), - // 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), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client.go b/sdk/resourcemanager/compute/armcompute/galleryimageversions_client.go index 5854c87eebe0..7f2804deefb3 100644 --- a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/galleryimageversions_client.go @@ -48,7 +48,7 @@ func NewGalleryImageVersionsClient(subscriptionID string, credential azcore.Toke // BeginCreateOrUpdate - Create or update a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition resides. // - galleryImageName - The name of the gallery image definition in which the Image Version is to be created. @@ -73,7 +73,7 @@ func (client *GalleryImageVersionsClient) BeginCreateOrUpdate(ctx context.Contex // CreateOrUpdate - Create or update a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryImageVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) if err != nil { @@ -117,7 +117,7 @@ func (client *GalleryImageVersionsClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, galleryImageVersion) @@ -126,7 +126,7 @@ func (client *GalleryImageVersionsClient) createOrUpdateCreateRequest(ctx contex // BeginDelete - Delete a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition resides. // - galleryImageName - The name of the gallery image definition in which the Image Version resides. @@ -148,7 +148,7 @@ func (client *GalleryImageVersionsClient) BeginDelete(ctx context.Context, resou // Delete - Delete a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryImageVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, options) if err != nil { @@ -192,7 +192,7 @@ func (client *GalleryImageVersionsClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -201,7 +201,7 @@ func (client *GalleryImageVersionsClient) deleteCreateRequest(ctx context.Contex // Get - Retrieves information about a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition resides. // - galleryImageName - The name of the gallery image definition in which the Image Version resides. @@ -254,7 +254,7 @@ func (client *GalleryImageVersionsClient) getCreateRequest(ctx context.Context, if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -271,7 +271,7 @@ func (client *GalleryImageVersionsClient) getHandleResponse(resp *http.Response) // NewListByGalleryImagePager - List gallery image versions in a gallery image definition. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition resides. // - galleryImageName - The name of the Shared Image Gallery Image Definition from which the Image Versions are to be listed. @@ -329,7 +329,7 @@ func (client *GalleryImageVersionsClient) listByGalleryImageCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,7 +347,7 @@ func (client *GalleryImageVersionsClient) listByGalleryImageHandleResponse(resp // BeginUpdate - Update a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery in which the Image Definition resides. // - galleryImageName - The name of the gallery image definition in which the Image Version is to be updated. @@ -372,7 +372,7 @@ func (client *GalleryImageVersionsClient) BeginUpdate(ctx context.Context, resou // Update - Update a gallery image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GalleryImageVersionsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) if err != nil { @@ -416,7 +416,7 @@ func (client *GalleryImageVersionsClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, galleryImageVersion) 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 45d8adabc3f5..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go +++ /dev/null @@ -1,1852 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // CommunityGalleryImageID: to.Ptr("/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // 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), - // SizeInGB: to.Ptr[int32](10), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // ReplicationMode: to.Ptr(armcompute.ReplicationModeShallow), - // 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), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // 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"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetExtendedLocations: []*armcompute.GalleryTargetExtendedLocation{ - // { - // 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](0), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // }, - // }, - // ExtendedLocation: &armcompute.GalleryExtendedLocation{ - // Name: to.Ptr("microsoftlosangeles1"), - // Type: to.Ptr(armcompute.GalleryExtendedLocationTypeEdgeZone), - // }, - // ExtendedLocationReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountType("StandardSSD_LRS(default)")), - // }, - // { - // 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](0), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // }, - // }, - // ExtendedLocation: &armcompute.GalleryExtendedLocation{ - // Name: to.Ptr("microsoftnewyork1"), - // Type: to.Ptr(armcompute.GalleryExtendedLocationTypeEdgeZone), - // }, - // ExtendedLocationReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountType("StandardSSD_LRS(default)")), - // }}, - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // 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), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // ReplicationStatus: &armcompute.ReplicationStatus{ - // AggregatedState: to.Ptr(armcompute.AggregatedReplicationStateCompleted), - // Summary: []*armcompute.RegionalReplicationStatus{ - // { - // Progress: to.Ptr[int32](100), - // Region: to.Ptr("West US"), - // State: to.Ptr(armcompute.ReplicationStateCompleted), - // Details: to.Ptr(""), - // }, - // { - // Progress: to.Ptr[int32](100), - // Region: to.Ptr("East US"), - // State: to.Ptr(armcompute.ReplicationStateCompleted), - // Details: to.Ptr(""), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{diskSnapshotName}"), - // }, - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{snapshotName}"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // 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"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryImageVersionsClient().NewListByGalleryImagePager("myResourceGroup", "myGalleryName", "myGalleryImageName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryImageVersionList = armcompute.GalleryImageVersionList{ - // Value: []*armcompute.GalleryImageVersion{ - // { - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // 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](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // 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), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client.go b/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client.go index 1e6b646054a5..687cfdbb1c6a 100644 --- a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client.go +++ b/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client.go @@ -48,7 +48,7 @@ func NewGallerySharingProfileClient(subscriptionID string, credential azcore.Tok // BeginUpdate - Update sharing profile of a gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - resourceGroupName - The name of the resource group. // - galleryName - The name of the Shared Image Gallery. // - sharingUpdate - Parameters supplied to the update gallery sharing profile. @@ -69,7 +69,7 @@ func (client *GallerySharingProfileClient) BeginUpdate(ctx context.Context, reso // Update - Update sharing profile of a gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 func (client *GallerySharingProfileClient) update(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, sharingUpdate, options) if err != nil { @@ -105,7 +105,7 @@ func (client *GallerySharingProfileClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, sharingUpdate) 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 8ec6bbe9ed29..000000000000 --- a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go +++ /dev/null @@ -1,130 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGallerySharingProfileClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharingUpdate = 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), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGallerySharingProfileClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharingUpdate = armcompute.SharingUpdate{ - // OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesReset), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGallerySharingProfileClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharingUpdate = armcompute.SharingUpdate{ - // OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesEnableCommunity), - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/go.mod b/sdk/resourcemanager/compute/armcompute/go.mod index 3527d6bde3ca..80422fa4833f 100644 --- a/sdk/resourcemanager/compute/armcompute/go.mod +++ b/sdk/resourcemanager/compute/armcompute/go.mod @@ -1,29 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 - github.com/stretchr/testify v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dnaeon/go-vcr v1.1.0 // indirect - github.com/golang-jwt/jwt/v4 v4.4.2 // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/compute/armcompute/go.sum b/sdk/resourcemanager/compute/armcompute/go.sum index 69e6a668b452..b6bd7eaad1ba 100644 --- a/sdk/resourcemanager/compute/armcompute/go.sum +++ b/sdk/resourcemanager/compute/armcompute/go.sum @@ -1,48 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 h1:7CBQ+Ei8SP2c6ydQTGCCrS35bDxgTMfoP2miAwK++OU= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1/go.mod h1:c/wcGeGx5FUPbM/JltUYHZcKmigwyVLJlDq+4HdtXaw= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 h1:VgSJlZH5u0k2qxSpqyghcFQKmvYckj46uymKK5XzkBM= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0/go.mod h1:BDJ5qMFKx9DugEg3+uQSDCdbYPr5s9vBTrL9P8TpqOU= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= -github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 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 0eea572161a7..000000000000 --- a/sdk/resourcemanager/compute/armcompute/images_client_example_test.go +++ /dev/null @@ -1,946 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // SourceVirtualMachine: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // }, - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myVM_OsDisk_1_6dc293b7d811433196903acf92665022"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // 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"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // 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{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // 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{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // 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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // DiskSizeGB: to.Ptr[int32](20), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImagesClient().Get(ctx, "myResourceGroup", "myImage", &armcompute.ImagesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // DiskSizeGB: to.Ptr[int32](20), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageListResult = armcompute.ImageListResult{ - // Value: []*armcompute.Image{ - // { - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageListResult = armcompute.ImageListResult{ - // Value: []*armcompute.Image{ - // { - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // }, - // }}, - // } - } -} 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 2d333ffd87ce..000000000000 --- a/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go +++ /dev/null @@ -1,93 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogAnalyticsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogAnalyticsOperationResult = armcompute.LogAnalyticsOperationResult{ - // Properties: &armcompute.LogAnalyticsOutput{ - // Output: to.Ptr("https://crptestar4227.blob.core.windows.net:443/sascontainer/RequestRateByInterval_20180121-0154_20180123-0154.csv"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogAnalyticsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogAnalyticsOperationResult = armcompute.LogAnalyticsOperationResult{ - // Properties: &armcompute.LogAnalyticsOutput{ - // Output: to.Ptr("https://crptestar4227.blob.core.windows.net:443/sascontainer/ThrottledRequests_20180121-0154_20180123-0154.csv"), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/models.go b/sdk/resourcemanager/compute/armcompute/models.go index 061236a13db9..5c308448a050 100644 --- a/sdk/resourcemanager/compute/armcompute/models.go +++ b/sdk/resourcemanager/compute/armcompute/models.go @@ -1091,6 +1091,9 @@ type CommunityGallery struct { // The identifier information of community gallery. Identifier *CommunityGalleryIdentifier + // Describes the properties of a community gallery. + Properties *CommunityGalleryProperties + // READ-ONLY; Resource location Location *string @@ -1151,12 +1154,18 @@ type CommunityGalleryImageProperties struct { // Linux OSType *OperatingSystemTypes - // The architecture of the image. Applicable to OS disks only. + // CPU architecture supported by an OS disk. Architecture *Architecture + // The artifact tags of a community gallery resource. + ArtifactTags map[string]*string + // Describes the disallowed disk types. Disallowed *Disallowed + // The disclaimer for a community gallery resource. + Disclaimer *string + // The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property // is updatable. EndOfLifeDate *time.Time @@ -1210,6 +1219,12 @@ type CommunityGalleryImageVersionList struct { // CommunityGalleryImageVersionProperties - Describes the properties of a gallery image version. type CommunityGalleryImageVersionProperties struct { + // The artifact tags of a community gallery resource. + ArtifactTags map[string]*string + + // The disclaimer for a community gallery resource. + Disclaimer *string + // The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This // property is updatable. EndOfLifeDate *time.Time @@ -1269,6 +1284,36 @@ type CommunityGalleryInfo struct { PublicNames []*string } +// CommunityGalleryMetadata - The metadata of community gallery. +type CommunityGalleryMetadata struct { + // The eula of this community gallery. + Eula *string + + // The privacyStatementUri of this community gallery. + PrivacyStatementURI *string + + // A list of public names the gallery has. + PublicNames []*string + + // The publisher contact of this community gallery. + PublisherContact *string + + // The publisher uri of this community gallery. + PublisherURI *string +} + +// CommunityGalleryProperties - Describes the properties of a community gallery. +type CommunityGalleryProperties struct { + // The artifact tags of a community gallery resource. + ArtifactTags map[string]*string + + // The metadata of community gallery. + CommunityMetadata *CommunityGalleryMetadata + + // The disclaimer for a community gallery resource. + Disclaimer *string +} + // CopyCompletionError - Indicates the error details if the background copy of a resource created via the CopyStart operation // fails. type CopyCompletionError struct { @@ -3103,7 +3148,7 @@ type GalleryImageProperties struct { // Linux OSType *OperatingSystemTypes - // The architecture of the image. Applicable to OS disks only. + // CPU architecture supported by an OS disk. Architecture *Architecture // The description of this gallery image definition resource. This property is updatable. @@ -5940,6 +5985,9 @@ type SharedGallery struct { // The identifier information of shared gallery. Identifier *SharedGalleryIdentifier + // Specifies the properties of a shared gallery + Properties *SharedGalleryProperties + // READ-ONLY; Resource location Location *string @@ -6017,9 +6065,12 @@ type SharedGalleryImageProperties struct { // Linux OSType *OperatingSystemTypes - // The architecture of the image. Applicable to OS disks only. + // CPU architecture supported by an OS disk. Architecture *Architecture + // The artifact tags of a shared gallery resource. + ArtifactTags map[string]*string + // Describes the disallowed disk types. Disallowed *Disallowed @@ -6073,6 +6124,9 @@ type SharedGalleryImageVersionList struct { // SharedGalleryImageVersionProperties - Describes the properties of a gallery image version. type SharedGalleryImageVersionProperties struct { + // The artifact tags of a shared gallery resource. + ArtifactTags map[string]*string + // The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This // property is updatable. EndOfLifeDate *time.Time @@ -6139,6 +6193,12 @@ type SharedGalleryOSDiskImage struct { DiskSizeGB *int32 } +// SharedGalleryProperties - Specifies the properties of a shared gallery +type SharedGalleryProperties struct { + // READ-ONLY; The artifact tags of a shared gallery resource. + ArtifactTags map[string]*string +} + // SharingProfile - Profile for gallery sharing to subscription or tenant type SharingProfile struct { // Information of community gallery if current gallery is shared to community. @@ -8200,9 +8260,6 @@ type VirtualMachineScaleSetIPConfiguration struct { // REQUIRED; The IP configuration name. Name *string - // Resource Id - ID *string - // Describes a virtual machine scale set network profile's IP configuration properties. Properties *VirtualMachineScaleSetIPConfigurationProperties } @@ -8350,9 +8407,6 @@ type VirtualMachineScaleSetNetworkConfiguration struct { // REQUIRED; The network configuration name. Name *string - // Resource Id - ID *string - // Describes a virtual machine scale set network profile's IP configuration. Properties *VirtualMachineScaleSetNetworkConfigurationProperties } diff --git a/sdk/resourcemanager/compute/armcompute/models_serde.go b/sdk/resourcemanager/compute/armcompute/models_serde.go index b1734e9e6023..d2d72d21b5b1 100644 --- a/sdk/resourcemanager/compute/armcompute/models_serde.go +++ b/sdk/resourcemanager/compute/armcompute/models_serde.go @@ -1824,6 +1824,7 @@ func (c CommunityGallery) MarshalJSON() ([]byte, error) { populate(objectMap, "identifier", c.Identifier) populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } @@ -1846,6 +1847,9 @@ func (c *CommunityGallery) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) @@ -1962,7 +1966,9 @@ func (c *CommunityGalleryImageList) UnmarshalJSON(data []byte) error { func (c CommunityGalleryImageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "architecture", c.Architecture) + populate(objectMap, "artifactTags", c.ArtifactTags) populate(objectMap, "disallowed", c.Disallowed) + populate(objectMap, "disclaimer", c.Disclaimer) populateTimeRFC3339(objectMap, "endOfLifeDate", c.EndOfLifeDate) populate(objectMap, "eula", c.Eula) populate(objectMap, "features", c.Features) @@ -1988,9 +1994,15 @@ func (c *CommunityGalleryImageProperties) UnmarshalJSON(data []byte) error { case "architecture": err = unpopulate(val, "Architecture", &c.Architecture) delete(rawMsg, key) + case "artifactTags": + err = unpopulate(val, "ArtifactTags", &c.ArtifactTags) + delete(rawMsg, key) case "disallowed": err = unpopulate(val, "Disallowed", &c.Disallowed) delete(rawMsg, key) + case "disclaimer": + err = unpopulate(val, "Disclaimer", &c.Disclaimer) + delete(rawMsg, key) case "endOfLifeDate": err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &c.EndOfLifeDate) delete(rawMsg, key) @@ -2106,6 +2118,8 @@ func (c *CommunityGalleryImageVersionList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageVersionProperties. func (c CommunityGalleryImageVersionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "artifactTags", c.ArtifactTags) + populate(objectMap, "disclaimer", c.Disclaimer) populateTimeRFC3339(objectMap, "endOfLifeDate", c.EndOfLifeDate) populate(objectMap, "excludeFromLatest", c.ExcludeFromLatest) populateTimeRFC3339(objectMap, "publishedDate", c.PublishedDate) @@ -2122,6 +2136,12 @@ func (c *CommunityGalleryImageVersionProperties) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { + case "artifactTags": + err = unpopulate(val, "ArtifactTags", &c.ArtifactTags) + delete(rawMsg, key) + case "disclaimer": + err = unpopulate(val, "Disclaimer", &c.Disclaimer) + delete(rawMsg, key) case "endOfLifeDate": err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &c.EndOfLifeDate) delete(rawMsg, key) @@ -2189,6 +2209,84 @@ func (c *CommunityGalleryInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryMetadata. +func (c CommunityGalleryMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eula", c.Eula) + populate(objectMap, "privacyStatementUri", c.PrivacyStatementURI) + populate(objectMap, "publicNames", c.PublicNames) + populate(objectMap, "publisherContact", c.PublisherContact) + populate(objectMap, "publisherUri", c.PublisherURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryMetadata. +func (c *CommunityGalleryMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eula": + err = unpopulate(val, "Eula", &c.Eula) + delete(rawMsg, key) + case "privacyStatementUri": + err = unpopulate(val, "PrivacyStatementURI", &c.PrivacyStatementURI) + delete(rawMsg, key) + case "publicNames": + err = unpopulate(val, "PublicNames", &c.PublicNames) + delete(rawMsg, key) + case "publisherContact": + err = unpopulate(val, "PublisherContact", &c.PublisherContact) + delete(rawMsg, key) + case "publisherUri": + err = unpopulate(val, "PublisherURI", &c.PublisherURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryProperties. +func (c CommunityGalleryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "artifactTags", c.ArtifactTags) + populate(objectMap, "communityMetadata", c.CommunityMetadata) + populate(objectMap, "disclaimer", c.Disclaimer) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryProperties. +func (c *CommunityGalleryProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "artifactTags": + err = unpopulate(val, "ArtifactTags", &c.ArtifactTags) + delete(rawMsg, key) + case "communityMetadata": + err = unpopulate(val, "CommunityMetadata", &c.CommunityMetadata) + delete(rawMsg, key) + case "disclaimer": + err = unpopulate(val, "Disclaimer", &c.Disclaimer) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CopyCompletionError. func (c CopyCompletionError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -11769,6 +11867,7 @@ func (s SharedGallery) MarshalJSON() ([]byte, error) { populate(objectMap, "identifier", s.Identifier) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } @@ -11790,6 +11889,9 @@ func (s *SharedGallery) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -11965,6 +12067,7 @@ func (s *SharedGalleryImageList) UnmarshalJSON(data []byte) error { func (s SharedGalleryImageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "architecture", s.Architecture) + populate(objectMap, "artifactTags", s.ArtifactTags) populate(objectMap, "disallowed", s.Disallowed) populateTimeRFC3339(objectMap, "endOfLifeDate", s.EndOfLifeDate) populate(objectMap, "eula", s.Eula) @@ -11991,6 +12094,9 @@ func (s *SharedGalleryImageProperties) UnmarshalJSON(data []byte) error { case "architecture": err = unpopulate(val, "Architecture", &s.Architecture) delete(rawMsg, key) + case "artifactTags": + err = unpopulate(val, "ArtifactTags", &s.ArtifactTags) + delete(rawMsg, key) case "disallowed": err = unpopulate(val, "Disallowed", &s.Disallowed) delete(rawMsg, key) @@ -12105,6 +12211,7 @@ func (s *SharedGalleryImageVersionList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SharedGalleryImageVersionProperties. func (s SharedGalleryImageVersionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "artifactTags", s.ArtifactTags) populateTimeRFC3339(objectMap, "endOfLifeDate", s.EndOfLifeDate) populate(objectMap, "excludeFromLatest", s.ExcludeFromLatest) populateTimeRFC3339(objectMap, "publishedDate", s.PublishedDate) @@ -12121,6 +12228,9 @@ func (s *SharedGalleryImageVersionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "artifactTags": + err = unpopulate(val, "ArtifactTags", &s.ArtifactTags) + delete(rawMsg, key) case "endOfLifeDate": err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &s.EndOfLifeDate) delete(rawMsg, key) @@ -12234,6 +12344,33 @@ func (s *SharedGalleryOSDiskImage) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryProperties. +func (s SharedGalleryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "artifactTags", s.ArtifactTags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryProperties. +func (s *SharedGalleryProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "artifactTags": + err = unpopulate(val, "ArtifactTags", &s.ArtifactTags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SharingProfile. func (s SharingProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -16193,7 +16330,6 @@ func (v *VirtualMachineScaleSetHardwareProfile) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetIPConfiguration. func (v VirtualMachineScaleSetIPConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) return json.Marshal(objectMap) @@ -16208,9 +16344,6 @@ func (v *VirtualMachineScaleSetIPConfiguration) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -16578,7 +16711,6 @@ func (v *VirtualMachineScaleSetManagedDiskParameters) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetNetworkConfiguration. func (v VirtualMachineScaleSetNetworkConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) return json.Marshal(objectMap) @@ -16593,9 +16725,6 @@ func (v *VirtualMachineScaleSetNetworkConfiguration) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) 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 4318839f1db9..000000000000 --- a/sdk/resourcemanager/compute/armcompute/operations_client_example_test.go +++ /dev/null @@ -1,83 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armcompute.OperationListResult{ - // Value: []*armcompute.OperationValue{ - // { - // Name: to.Ptr("aaaaaaaaaaaa"), - // Display: &armcompute.OperationValueDisplay{ - // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Operation: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Provider: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Resource: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Origin: to.Ptr("aaaaa"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armcompute.OperationListResult{ - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/proximityplacementgroup_live_test.go b/sdk/resourcemanager/compute/armcompute/proximityplacementgroup_live_test.go deleted file mode 100644 index 47694732ad4b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/proximityplacementgroup_live_test.go +++ /dev/null @@ -1,118 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type ProximityPlacementGroupTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - location string - proximityPlacementGroupName string - resourceGroupName string - subscriptionId string -} - -func (testsuite *ProximityPlacementGroupTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.proximityPlacementGroupName = testutil.GenerateAlphaNumericID(testsuite.T(), "proximityp", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *ProximityPlacementGroupTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestProximityPlacementGroupTestSuite(t *testing.T) { - suite.Run(t, new(ProximityPlacementGroupTestSuite)) -} - -// Microsoft.Compute/proximityPlacementGroups -func (testsuite *ProximityPlacementGroupTestSuite) TestProximityPlacementGroups() { - var err error - // From step ProximityPlacementGroups_CreateOrUpdate - fmt.Println("Call operation: ProximityPlacementGroups_CreateOrUpdate") - proximityPlacementGroupsClient, err := armcompute.NewProximityPlacementGroupsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = proximityPlacementGroupsClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.proximityPlacementGroupName, armcompute.ProximityPlacementGroup{ - Location: to.Ptr(testsuite.location), - 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) - testsuite.Require().NoError(err) - - // From step ProximityPlacementGroups_ListBySubscription - fmt.Println("Call operation: ProximityPlacementGroups_ListBySubscription") - proximityPlacementGroupsClientNewListBySubscriptionPager := proximityPlacementGroupsClient.NewListBySubscriptionPager(nil) - for proximityPlacementGroupsClientNewListBySubscriptionPager.More() { - _, err := proximityPlacementGroupsClientNewListBySubscriptionPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step ProximityPlacementGroups_ListByResourceGroup - fmt.Println("Call operation: ProximityPlacementGroups_ListByResourceGroup") - proximityPlacementGroupsClientNewListByResourceGroupPager := proximityPlacementGroupsClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for proximityPlacementGroupsClientNewListByResourceGroupPager.More() { - _, err := proximityPlacementGroupsClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step ProximityPlacementGroups_Get - fmt.Println("Call operation: ProximityPlacementGroups_Get") - _, err = proximityPlacementGroupsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.proximityPlacementGroupName, &armcompute.ProximityPlacementGroupsClientGetOptions{IncludeColocationStatus: nil}) - testsuite.Require().NoError(err) - - // From step ProximityPlacementGroups_Update - fmt.Println("Call operation: ProximityPlacementGroups_Update") - _, err = proximityPlacementGroupsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.proximityPlacementGroupName, armcompute.ProximityPlacementGroupUpdate{ - Tags: map[string]*string{ - "additionalProp1": to.Ptr("string"), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step ProximityPlacementGroups_Delete - fmt.Println("Call operation: ProximityPlacementGroups_Delete") - _, err = proximityPlacementGroupsClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.proximityPlacementGroupName, nil) - testsuite.Require().NoError(err) -} 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 135ca307e14b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go +++ /dev/null @@ -1,277 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProximityPlacementGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProximityPlacementGroup = armcompute.ProximityPlacementGroup{ - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // 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")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProximityPlacementGroupsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProximityPlacementGroup = armcompute.ProximityPlacementGroup{ - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProximityPlacementGroupsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProximityPlacementGroupsClient().Get(ctx, "myResourceGroup", "myProximityPlacementGroup", &armcompute.ProximityPlacementGroupsClientGetOptions{IncludeColocationStatus: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProximityPlacementGroup = armcompute.ProximityPlacementGroup{ - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // AvailabilitySets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - // VMSizes: []*string{ - // to.Ptr("Basic_A0"), - // to.Ptr("Basic_A2")}, - // }, - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // VirtualMachineScaleSets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // VirtualMachines: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProximityPlacementGroupsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProximityPlacementGroupListResult = armcompute.ProximityPlacementGroupListResult{ - // Value: []*armcompute.ProximityPlacementGroup{ - // { - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // AvailabilitySets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - // VMSizes: []*string{ - // to.Ptr("Basic_A0"), - // to.Ptr("Basic_A2")}, - // }, - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // VirtualMachineScaleSets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // VirtualMachines: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProximityPlacementGroupsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProximityPlacementGroupListResult = armcompute.ProximityPlacementGroupListResult{ - // Value: []*armcompute.ProximityPlacementGroup{ - // { - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // AvailabilitySets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - // VMSizes: []*string{ - // to.Ptr("Basic_A0"), - // to.Ptr("Basic_A2")}, - // }, - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // VirtualMachineScaleSets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // VirtualMachines: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} 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 266ed7384b90..000000000000 --- a/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go +++ /dev/null @@ -1,612 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceSKUsClient().NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil, - IncludeExtendedLocations: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceSKUsResult = armcompute.ResourceSKUsResult{ - // Value: []*armcompute.ResourceSKU{ - // { - // Name: to.Ptr("Standard_A0"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // ZoneDetails: []*armcompute.ResourceSKUZoneDetails{ - // { - // Name: []*string{ - // to.Ptr("2")}, - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("UltraSSDAvailable"), - // Value: to.Ptr("True"), - // }}, - // }}, - // Zones: []*string{ - // to.Ptr("2"), - // to.Ptr("1")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_A1"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("71680"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("1.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A1"), - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceSKUsClient().NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: to.Ptr("location eq 'westus'"), - IncludeExtendedLocations: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceSKUsResult = armcompute.ResourceSKUsResult{ - // Value: []*armcompute.ResourceSKU{ - // { - // Name: to.Ptr("Standard_A0"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // ZoneDetails: []*armcompute.ResourceSKUZoneDetails{ - // { - // Name: []*string{ - // to.Ptr("2")}, - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("UltraSSDAvailable"), - // Value: to.Ptr("True"), - // }}, - // }}, - // Zones: []*string{ - // to.Ptr("2"), - // to.Ptr("1")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_A1"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("71680"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("1.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A1"), - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceSKUsClient().NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil, - IncludeExtendedLocations: to.Ptr("true"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceSKUsResult = armcompute.ResourceSKUsResult{ - // Value: []*armcompute.ResourceSKU{ - // { - // Name: to.Ptr("Standard_A0"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // ZoneDetails: []*armcompute.ResourceSKUZoneDetails{ - // { - // Name: []*string{ - // to.Ptr("2")}, - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("UltraSSDAvailable"), - // Value: to.Ptr("True"), - // }}, - // }}, - // Zones: []*string{ - // to.Ptr("2"), - // to.Ptr("1")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_A1"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("71680"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("1.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Type: to.Ptr(armcompute.ExtendedLocationTypeEdgeZone), - // ExtendedLocations: []*string{ - // to.Ptr("Las Vegas"), - // to.Ptr("Seattle"), - // to.Ptr("Portland")}, - // Location: to.Ptr("westus"), - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A1"), - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/restorepoint_live_test.go b/sdk/resourcemanager/compute/armcompute/restorepoint_live_test.go deleted file mode 100644 index cf14b432a779..000000000000 --- a/sdk/resourcemanager/compute/armcompute/restorepoint_live_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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/stretchr/testify/suite" -) - -type RestorePointTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - adminUsername string - networkInterfaceId string - networkInterfaceName string - restorePointCollectionName string - virtaulMachineId string - virtualNetworksName string - vmName string - adminPassword string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *RestorePointTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.adminUsername = testutil.GenerateAlphaNumericID(testsuite.T(), "rp", 6) - testsuite.networkInterfaceName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmnicrp", 6) - testsuite.restorePointCollectionName = testutil.GenerateAlphaNumericID(testsuite.T(), "restorepoi", 6) - testsuite.virtualNetworksName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmvnetrp", 6) - testsuite.vmName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmnamerp", 6) - testsuite.adminPassword = testutil.GetEnv("ADMIN_PASSWORD", "") - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *RestorePointTestSuite) TearDownSuite() { - testsuite.Cleanup() - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestRestorePointTestSuite(t *testing.T) { - suite.Run(t, new(RestorePointTestSuite)) -} - -func (testsuite *RestorePointTestSuite) Prepare() { - var err error - // From step Create_NetworkInterface - template := map[string]any{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]any{ - "networkInterfaceId": map[string]any{ - "type": "string", - "value": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]", - }, - }, - "parameters": map[string]any{ - "location": map[string]any{ - "type": "string", - "defaultValue": testsuite.location, - }, - "networkInterfaceName": map[string]any{ - "type": "string", - "defaultValue": testsuite.networkInterfaceName, - }, - "virtualNetworksName": map[string]any{ - "type": "string", - "defaultValue": testsuite.virtualNetworksName, - }, - }, - "resources": []any{ - map[string]any{ - "name": "[parameters('virtualNetworksName')]", - "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2021-05-01", - "location": "[parameters('location')]", - "properties": map[string]any{ - "addressSpace": map[string]any{ - "addressPrefixes": []any{ - "10.0.0.0/16", - }, - }, - "subnets": []any{ - map[string]any{ - "name": "default", - "properties": map[string]any{ - "addressPrefix": "10.0.0.0/24", - }, - }, - }, - }, - }, - map[string]any{ - "name": "[parameters('networkInterfaceName')]", - "type": "Microsoft.Network/networkInterfaces", - "apiVersion": "2021-08-01", - "dependsOn": []any{ - "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworksName'))]", - }, - "location": "[parameters('location')]", - "properties": map[string]any{ - "ipConfigurations": []any{ - map[string]any{ - "name": "Ipv4config", - "properties": map[string]any{ - "subnet": map[string]any{ - "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworksName'), 'default')]", - }, - }, - }, - }, - }, - }, - }, - } - deployment := armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err := testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "Create_NetworkInterface", &deployment) - testsuite.Require().NoError(err) - testsuite.networkInterfaceId = deploymentExtend.Properties.Outputs.(map[string]interface{})["networkInterfaceId"].(map[string]interface{})["value"].(string) - - // From step VirtualMachines_CreateOrUpdate - fmt.Println("Call operation: VirtualMachines_CreateOrUpdate") - virtualMachinesClient, err := armcompute.NewVirtualMachinesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachinesClientCreateOrUpdateResponsePoller, err := virtualMachinesClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, armcompute.VirtualMachine{ - Location: to.Ptr(testsuite.location), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr(testsuite.networkInterfaceId), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr(testsuite.adminPassword), - AdminUsername: to.Ptr(testsuite.adminUsername), - ComputerName: to.Ptr(testsuite.vmName), - }, - 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(testsuite.vmName + "osdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - testsuite.Require().NoError(err) - var virtualMachinesClientCreateOrUpdateResponse *armcompute.VirtualMachinesClientCreateOrUpdateResponse - virtualMachinesClientCreateOrUpdateResponse, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) - testsuite.virtaulMachineId = *virtualMachinesClientCreateOrUpdateResponse.ID - - // From step RestorePointCollections_CreateOrUpdate - fmt.Println("Call operation: RestorePointCollections_CreateOrUpdate") - restorePointCollectionsClient, err := armcompute.NewRestorePointCollectionsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = restorePointCollectionsClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.restorePointCollectionName, armcompute.RestorePointCollection{ - Location: to.Ptr(testsuite.location), - Tags: map[string]*string{ - "myTag1": to.Ptr("tagValue1"), - }, - Properties: &armcompute.RestorePointCollectionProperties{ - Source: &armcompute.RestorePointCollectionSourceProperties{ - ID: to.Ptr(testsuite.virtaulMachineId), - }, - }, - }, nil) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/restorePointCollections -func (testsuite *RestorePointTestSuite) TestRestorePointCollections() { - var err error - // From step RestorePointCollections_ListAll - fmt.Println("Call operation: RestorePointCollections_ListAll") - restorePointCollectionsClient, err := armcompute.NewRestorePointCollectionsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - restorePointCollectionsClientNewListAllPager := restorePointCollectionsClient.NewListAllPager(nil) - for restorePointCollectionsClientNewListAllPager.More() { - _, err := restorePointCollectionsClientNewListAllPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step RestorePointCollections_List - fmt.Println("Call operation: RestorePointCollections_List") - restorePointCollectionsClientNewListPager := restorePointCollectionsClient.NewListPager(testsuite.resourceGroupName, nil) - for restorePointCollectionsClientNewListPager.More() { - _, err := restorePointCollectionsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step RestorePointCollections_Get - fmt.Println("Call operation: RestorePointCollections_Get") - _, err = restorePointCollectionsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.restorePointCollectionName, &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil}) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/restorePointCollections/restorePoints -func (testsuite *RestorePointTestSuite) TestRestorePoints() { - restorePointName := testutil.GenerateAlphaNumericID(testsuite.T(), "restorepoi", 6) - var err error - // From step RestorePoints_Create - fmt.Println("Call operation: RestorePoints_Create") - restorePointsClient, err := armcompute.NewRestorePointsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - restorePointsClientCreateResponsePoller, err := restorePointsClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.restorePointCollectionName, restorePointName, armcompute.RestorePoint{}, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, restorePointsClientCreateResponsePoller) - testsuite.Require().NoError(err) - - // From step RestorePoints_Get - fmt.Println("Call operation: RestorePoints_Get") - _, err = restorePointsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.restorePointCollectionName, restorePointName, &armcompute.RestorePointsClientGetOptions{Expand: nil}) - testsuite.Require().NoError(err) - - // From step RestorePoints_Delete - fmt.Println("Call operation: RestorePoints_Delete") - restorePointsClientDeleteResponsePoller, err := restorePointsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.restorePointCollectionName, restorePointName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, restorePointsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} - -func (testsuite *RestorePointTestSuite) Cleanup() { - var err error - // From step RestorePointCollections_Update - restorePointCollectionsClient, err := armcompute.NewRestorePointCollectionsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - fmt.Println("Call operation: RestorePointCollections_Update") - _, err = restorePointCollectionsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.restorePointCollectionName, armcompute.RestorePointCollectionUpdate{}, nil) - testsuite.Require().NoError(err) - // From step RestorePointCollections_Delete - fmt.Println("Call operation: RestorePointCollections_Delete") - restorePointCollectionsClientDeleteResponsePoller, err := restorePointCollectionsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.restorePointCollectionName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, restorePointCollectionsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} 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 73a97aacd44c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go +++ /dev/null @@ -1,634 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("norwayeast"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("638f052b-a7c2-450c-89e7-6a3b8f1d6a7c"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("norwayeast"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("638f052b-a7c2-450c-89e7-6a3b8f1d6a7c"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("norwayeast"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("638f052b-a7c2-450c-89e7-6a3b8f1d6a7c"), - // RestorePoints: []*armcompute.RestorePoint{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaa"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesCrashConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](9), - // VCPUsPerCore: to.Ptr[int32](12), - // }, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // 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{ - // { - // 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), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // 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.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // DiskSizeGB: to.Ptr[int32](24), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // DiskSizeGB: to.Ptr[int32](3), - // 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}"), - // }, - // }, - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.593Z"); return t}()), - // }, - // }}, - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", armcompute.RestorePointCollectionUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Location: to.Ptr("norwayeast"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointCollectionsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointCollectionsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().Get(ctx, "myResourceGroup", "myRpc", &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().Get(ctx, "myResourceGroup", "rpcName", &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("rpcName"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // RestorePoints: []*armcompute.RestorePoint{ - // { - // Name: to.Ptr("restorePointName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesApplicationConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vm8768_disk2_fe6ffde4f69b491ca33fb984d5bcd89f"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // }, - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-27T20:35:05.8401519+00:00"); return t}()), - // }, - // }}, - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorePointCollectionsClient().NewListPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorePointCollectionListResult = armcompute.RestorePointCollectionListResult{ - // Value: []*armcompute.RestorePointCollection{ - // { - // Name: to.Ptr("restorePointCollection1"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection1"), - // Location: to.Ptr("westus"), - // }, - // }, - // }, - // { - // Name: to.Ptr("restorePointCollection2"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("2875c590-e337-4102-9668-4f5b7e3f98a4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection2"), - // Location: to.Ptr("westus"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorePointCollectionsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorePointCollectionListResult = armcompute.RestorePointCollectionListResult{ - // Value: []*armcompute.RestorePointCollection{ - // { - // Name: to.Ptr("restorePointCollection1"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resourceGroup1/providers/Microsoft.Compute/restorePointCollections/restorePointCollection1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/VM_Test"), - // Location: to.Ptr("westus"), - // }, - // }, - // }, - // { - // Name: to.Ptr("restorePointCollection2"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resourceGroup2/providers/Microsoft.Compute/restorePointCollections/restorePointCollection2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("2875c590-e337-4102-9668-4f5b7e3f98a4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/VM_Prod"), - // Location: to.Ptr("westus"), - // }, - // }, - // }}, - // } - } -} 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 51ee39d9e4fc..000000000000 --- a/sdk/resourcemanager/compute/armcompute/restorepoints_client_example_test.go +++ /dev/null @@ -1,315 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointsClient().Get(ctx, "myResourceGroup", "rpcName", "rpName", &armcompute.RestorePointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePoint = armcompute.RestorePoint{ - // Name: to.Ptr("rpName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesApplicationConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vm8768_disk2_fe6ffde4f69b491ca33fb984d5bcd89f"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // }, - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/restorePointCollections/mynewrpc/restorePoints/restorepointtwo/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-27T20:35:05.8401519+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointsClient().Get(ctx, "myResourceGroup", "rpcName", "rpName", &armcompute.RestorePointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePoint = armcompute.RestorePoint{ - // Name: to.Ptr("rpName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesApplicationConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vm8768_disk2_fe6ffde4f69b491ca33fb984d5bcd89f"), - // }}, - // InstanceView: &armcompute.RestorePointInstanceView{ - // DiskRestorePoints: []*armcompute.DiskRestorePointInstanceView{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // ReplicationStatus: &armcompute.DiskRestorePointReplicationStatus{ - // CompletionPercent: to.Ptr[int32](100), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("ReplicationState/succeeded"), - // DisplayStatus: to.Ptr("Succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/restorePointCollections/mynewrpc/restorePoints/restorepointtwo/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // ReplicationStatus: &armcompute.DiskRestorePointReplicationStatus{ - // CompletionPercent: to.Ptr[int32](100), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("ReplicationState/succeeded"), - // DisplayStatus: to.Ptr("Succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // }, - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ReplicationState/succeeded"), - // DisplayStatus: to.Ptr("Succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // }, - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/restorePointCollections/mynewrpc/restorePoints/restorepointtwo/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-27T20:35:05.8401519+00:00"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/runcommand_live_test.go b/sdk/resourcemanager/compute/armcompute/runcommand_live_test.go deleted file mode 100644 index 6f7874afa6d4..000000000000 --- a/sdk/resourcemanager/compute/armcompute/runcommand_live_test.go +++ /dev/null @@ -1,495 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/stretchr/testify/suite" -) - -type RunCommandTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - adminUsername string - networkInterfaceId string - networkInterfaceName string - subnetId string - virtualNetworkSubnetName string - virtualNetworksName string - vmName string - vmScaleSetName string - vmRunCommandName string - vmssRunCommandName string - adminPassword string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *RunCommandTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.adminUsername = testutil.GenerateAlphaNumericID(testsuite.T(), "rc", 6) - testsuite.networkInterfaceName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmnicrc", 6) - testsuite.virtualNetworkSubnetName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmssvnetnarc", 6) - testsuite.virtualNetworksName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmvnetrc", 6) - testsuite.vmName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmcommand", 6) - testsuite.vmScaleSetName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmscalesetcommand", 6) - testsuite.vmRunCommandName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmruncommand", 6) - testsuite.vmssRunCommandName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmssruncommand", 6) - testsuite.adminPassword = testutil.GetEnv("ADMIN_PASSWORD", "") - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *RunCommandTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestRunCommandTestSuite(t *testing.T) { - suite.Run(t, new(RunCommandTestSuite)) -} - -func (testsuite *RunCommandTestSuite) Prepare() { - var err error - // From step Create_NetworkInterface - template := map[string]any{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]any{ - "networkInterfaceId": map[string]any{ - "type": "string", - "value": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]", - }, - }, - "parameters": map[string]any{ - "location": map[string]any{ - "type": "string", - "defaultValue": testsuite.location, - }, - "networkInterfaceName": map[string]any{ - "type": "string", - "defaultValue": testsuite.networkInterfaceName, - }, - "virtualNetworksName": map[string]any{ - "type": "string", - "defaultValue": testsuite.virtualNetworksName, - }, - }, - "resources": []any{ - map[string]any{ - "name": "[parameters('virtualNetworksName')]", - "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2021-05-01", - "location": "[parameters('location')]", - "properties": map[string]any{ - "addressSpace": map[string]any{ - "addressPrefixes": []any{ - "10.0.0.0/16", - }, - }, - "subnets": []any{ - map[string]any{ - "name": "default", - "properties": map[string]any{ - "addressPrefix": "10.0.0.0/24", - }, - }, - }, - }, - }, - map[string]any{ - "name": "[parameters('networkInterfaceName')]", - "type": "Microsoft.Network/networkInterfaces", - "apiVersion": "2021-08-01", - "dependsOn": []any{ - "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworksName'))]", - }, - "location": "[parameters('location')]", - "properties": map[string]any{ - "ipConfigurations": []any{ - map[string]any{ - "name": "Ipv4config", - "properties": map[string]any{ - "subnet": map[string]any{ - "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworksName'), 'default')]", - }, - }, - }, - }, - }, - }, - }, - } - deployment := armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err := testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "Create_NetworkInterface", &deployment) - testsuite.Require().NoError(err) - testsuite.networkInterfaceId = deploymentExtend.Properties.Outputs.(map[string]interface{})["networkInterfaceId"].(map[string]interface{})["value"].(string) - - // From step VirtualMachines_CreateOrUpdate - fmt.Println("Call operation: VirtualMachines_CreateOrUpdate") - virtualMachinesClient, err := armcompute.NewVirtualMachinesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachinesClientCreateOrUpdateResponsePoller, err := virtualMachinesClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, armcompute.VirtualMachine{ - Location: to.Ptr(testsuite.location), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr(testsuite.networkInterfaceId), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr(testsuite.adminPassword), - AdminUsername: to.Ptr(testsuite.adminUsername), - ComputerName: to.Ptr(testsuite.vmName), - }, - 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(testsuite.vmName + "osdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step Create_NetworkAndSubnet - template = map[string]any{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]any{ - "subnetId": map[string]any{ - "type": "string", - "value": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkSubnetName'), 'default')]", - }, - }, - "parameters": map[string]any{ - "location": map[string]any{ - "type": "string", - "defaultValue": testsuite.location, - }, - "virtualNetworkSubnetName": map[string]any{ - "type": "string", - "defaultValue": testsuite.virtualNetworkSubnetName, - }, - }, - "resources": []any{ - map[string]any{ - "name": "[parameters('virtualNetworkSubnetName')]", - "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2021-05-01", - "location": "[parameters('location')]", - "properties": map[string]any{ - "addressSpace": map[string]any{ - "addressPrefixes": []any{ - "10.0.0.0/16", - }, - }, - "subnets": []any{ - map[string]any{ - "name": "default", - "properties": map[string]any{ - "addressPrefix": "10.0.0.0/24", - }, - }, - }, - }, - }, - }, - } - deployment = armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err = testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "Create_NetworkAndSubnet", &deployment) - testsuite.Require().NoError(err) - testsuite.subnetId = deploymentExtend.Properties.Outputs.(map[string]interface{})["subnetId"].(map[string]interface{})["value"].(string) - - // From step VirtualMachineScaleSets_CreateOrUpdate - fmt.Println("Call operation: VirtualMachineScaleSets_CreateOrUpdate") - virtualMachineScaleSetsClient, err := armcompute.NewVirtualMachineScaleSetsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachineScaleSetsClientCreateOrUpdateResponsePoller, err := virtualMachineScaleSetsClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, armcompute.VirtualMachineScaleSet{ - Location: to.Ptr(testsuite.location), - 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(testsuite.vmScaleSetName), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr(testsuite.vmScaleSetName), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr(testsuite.subnetId), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr(testsuite.adminPassword), - AdminUsername: to.Ptr(testsuite.adminUsername), - ComputerNamePrefix: to.Ptr("vmss"), - }, - 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) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName} -func (testsuite *RunCommandTestSuite) TestVirtualMachineRunCommands() { - var err error - // From step VirtualMachineRunCommands_CreateOrUpdate - fmt.Println("Call operation: VirtualMachineRunCommands_CreateOrUpdate") - virtualMachineRunCommandsClient, err := armcompute.NewVirtualMachineRunCommandsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachineRunCommandsClientCreateOrUpdateResponsePoller, err := virtualMachineRunCommandsClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, testsuite.vmRunCommandName, armcompute.VirtualMachineRunCommand{ - Location: to.Ptr(testsuite.location), - 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) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineRunCommandsClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineRunCommands_List - fmt.Println("Call operation: VirtualMachineRunCommands_List") - virtualMachineRunCommandsClientNewListPager := virtualMachineRunCommandsClient.NewListPager(testsuite.location, nil) - for virtualMachineRunCommandsClientNewListPager.More() { - _, err := virtualMachineRunCommandsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachineRunCommands_Get - fmt.Println("Call operation: VirtualMachineRunCommands_Get") - _, err = virtualMachineRunCommandsClient.Get(testsuite.ctx, testsuite.location, "RunPowerShellScript", nil) - testsuite.Require().NoError(err) - - // From step VirtualMachineRunCommands_ListByVirtualMachine - fmt.Println("Call operation: VirtualMachineRunCommands_ListByVirtualMachine") - virtualMachineRunCommandsClientNewListByVirtualMachinePager := virtualMachineRunCommandsClient.NewListByVirtualMachinePager(testsuite.resourceGroupName, testsuite.vmName, &armcompute.VirtualMachineRunCommandsClientListByVirtualMachineOptions{Expand: nil}) - for virtualMachineRunCommandsClientNewListByVirtualMachinePager.More() { - _, err := virtualMachineRunCommandsClientNewListByVirtualMachinePager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachineRunCommands_GetByVirtualMachine - fmt.Println("Call operation: VirtualMachineRunCommands_GetByVirtualMachine") - _, err = virtualMachineRunCommandsClient.GetByVirtualMachine(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, testsuite.vmRunCommandName, &armcompute.VirtualMachineRunCommandsClientGetByVirtualMachineOptions{Expand: nil}) - testsuite.Require().NoError(err) - - // From step VirtualMachineRunCommands_Update - fmt.Println("Call operation: VirtualMachineRunCommands_Update") - virtualMachineRunCommandsClientUpdateResponsePoller, err := virtualMachineRunCommandsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, testsuite.vmRunCommandName, armcompute.VirtualMachineRunCommandUpdate{ - Properties: &armcompute.VirtualMachineRunCommandProperties{ - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - Script: to.Ptr("Write-Host Script Source Updated!"), - }, - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineRunCommandsClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachines_RunCommand - fmt.Println("Call operation: VirtualMachines_RunCommand") - virtualMachinesClient, err := armcompute.NewVirtualMachinesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachinesClientRunCommandResponsePoller, err := virtualMachinesClient.BeginRunCommand(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, armcompute.RunCommandInput{ - CommandID: to.Ptr("RunPowerShellScript"), - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientRunCommandResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineRunCommands_Delete - fmt.Println("Call operation: VirtualMachineRunCommands_Delete") - virtualMachineRunCommandsClientDeleteResponsePoller, err := virtualMachineRunCommandsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, testsuite.vmRunCommandName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineRunCommandsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName} -func (testsuite *RunCommandTestSuite) TestVirtualMachineScaleSetVmRunCommands() { - var err error - // From step VirtualMachineScaleSetVMRunCommands_CreateOrUpdate - fmt.Println("Call operation: VirtualMachineScaleSetVMRunCommands_CreateOrUpdate") - virtualMachineScaleSetVMRunCommandsClient, err := armcompute.NewVirtualMachineScaleSetVMRunCommandsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponsePoller, err := virtualMachineScaleSetVMRunCommandsClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, "0", testsuite.vmssRunCommandName, armcompute.VirtualMachineRunCommand{ - Location: to.Ptr(testsuite.location), - 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) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMRunCommands_List - fmt.Println("Call operation: VirtualMachineScaleSetVMRunCommands_List") - virtualMachineScaleSetVMRunCommandsClientNewListPager := virtualMachineScaleSetVMRunCommandsClient.NewListPager(testsuite.resourceGroupName, testsuite.vmScaleSetName, "0", &armcompute.VirtualMachineScaleSetVMRunCommandsClientListOptions{Expand: nil}) - for virtualMachineScaleSetVMRunCommandsClientNewListPager.More() { - _, err := virtualMachineScaleSetVMRunCommandsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachineScaleSetVMRunCommands_Get - fmt.Println("Call operation: VirtualMachineScaleSetVMRunCommands_Get") - _, err = virtualMachineScaleSetVMRunCommandsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, "0", testsuite.vmssRunCommandName, &armcompute.VirtualMachineScaleSetVMRunCommandsClientGetOptions{Expand: nil}) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMRunCommands_Update - fmt.Println("Call operation: VirtualMachineScaleSetVMRunCommands_Update") - virtualMachineScaleSetVMRunCommandsClientUpdateResponsePoller, err := virtualMachineScaleSetVMRunCommandsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, "0", testsuite.vmssRunCommandName, armcompute.VirtualMachineRunCommandUpdate{ - Properties: &armcompute.VirtualMachineRunCommandProperties{ - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - Script: to.Ptr("Write-Host Script Source Updated!"), - }, - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMRunCommandsClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMs_RunCommand - fmt.Println("Call operation: VirtualMachineScaleSetVMs_RunCommand") - virtualMachineScaleSetVMsClient, err := armcompute.NewVirtualMachineScaleSetVMsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachineScaleSetVMsClientRunCommandResponsePoller, err := virtualMachineScaleSetVMsClient.BeginRunCommand(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, "0", armcompute.RunCommandInput{ - CommandID: to.Ptr("RunPowerShellScript"), - Script: []*string{ - to.Ptr("Write-Host Hello World!")}, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMsClientRunCommandResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMRunCommands_Delete - fmt.Println("Call operation: VirtualMachineScaleSetVMRunCommands_Delete") - virtualMachineScaleSetVMRunCommandsClientDeleteResponsePoller, err := virtualMachineScaleSetVMRunCommandsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, "0", testsuite.vmssRunCommandName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMRunCommandsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client.go b/sdk/resourcemanager/compute/armcompute/sharedgalleries_client.go index b9a9467e6f4b..284d07b25df8 100644 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client.go +++ b/sdk/resourcemanager/compute/armcompute/sharedgalleries_client.go @@ -48,7 +48,7 @@ func NewSharedGalleriesClient(subscriptionID string, credential azcore.TokenCred // Get - Get a shared gallery by subscription id or tenant id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - galleryUniqueName - The unique name of the Shared Gallery. // - options - SharedGalleriesClientGetOptions contains the optional parameters for the SharedGalleriesClient.Get method. @@ -87,7 +87,7 @@ func (client *SharedGalleriesClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -104,7 +104,7 @@ func (client *SharedGalleriesClient) getHandleResponse(resp *http.Response) (Sha // NewListPager - List shared galleries by subscription id or tenant id. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - options - SharedGalleriesClientListOptions contains the optional parameters for the SharedGalleriesClient.NewListPager // method. @@ -152,7 +152,7 @@ func (client *SharedGalleriesClient) listCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") if options != nil && options.SharedTo != nil { reqQP.Set("sharedTo", string(*options.SharedTo)) } 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 b90b7f25b340..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleries_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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedGalleriesClient().NewListPager("myLocation", &armcompute.SharedGalleriesClientListOptions{SharedTo: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedGalleryList = armcompute.SharedGalleryList{ - // Value: []*armcompute.SharedGallery{ - // { - // Name: to.Ptr("galleryUniqueName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedGalleriesClient().Get(ctx, "myLocation", "galleryUniqueName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedGallery = armcompute.SharedGallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName"), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client.go index 0f6618d263fc..4f62bdb7ee22 100644 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client.go @@ -48,7 +48,7 @@ func NewSharedGalleryImagesClient(subscriptionID string, credential azcore.Token // Get - Get a shared gallery image by subscription id or tenant id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - galleryUniqueName - The unique name of the Shared Gallery. // - galleryImageName - The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. @@ -92,7 +92,7 @@ func (client *SharedGalleryImagesClient) getCreateRequest(ctx context.Context, l return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +109,7 @@ func (client *SharedGalleryImagesClient) getHandleResponse(resp *http.Response) // NewListPager - List shared gallery images by subscription id or tenant id. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - galleryUniqueName - The unique name of the Shared Gallery. // - options - SharedGalleryImagesClientListOptions contains the optional parameters for the SharedGalleryImagesClient.NewListPager @@ -162,7 +162,7 @@ func (client *SharedGalleryImagesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") if options != nil && options.SharedTo != nil { reqQP.Set("sharedTo", string(*options.SharedTo)) } 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 55db7dba42b8..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go +++ /dev/null @@ -1,102 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedGalleryImagesClient().NewListPager("myLocation", "galleryUniqueName", &armcompute.SharedGalleryImagesClientListOptions{SharedTo: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedGalleryImageList = armcompute.SharedGalleryImageList{ - // Value: []*armcompute.SharedGalleryImage{ - // { - // Name: to.Ptr("myGalleryImageName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName"), - // }, - // Properties: &armcompute.SharedGalleryImageProperties{ - // 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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedGalleryImagesClient().Get(ctx, "myLocation", "galleryUniqueName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedGalleryImage = armcompute.SharedGalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName"), - // }, - // Properties: &armcompute.SharedGalleryImageProperties{ - // Eula: to.Ptr("https://www.microsoft.com/en-us/"), - // 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), - // PrivacyStatementURI: to.Ptr("https://www.microsoft.com/en-us/"), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client.go index a688c3cbfcdd..7e8ac5222603 100644 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client.go @@ -48,7 +48,7 @@ func NewSharedGalleryImageVersionsClient(subscriptionID string, credential azcor // Get - Get a shared gallery image version by subscription id or tenant id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - galleryUniqueName - The unique name of the Shared Gallery. // - galleryImageName - The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. @@ -100,7 +100,7 @@ func (client *SharedGalleryImageVersionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +117,7 @@ func (client *SharedGalleryImageVersionsClient) getHandleResponse(resp *http.Res // NewListPager - List shared gallery image versions by subscription id or tenant id. // -// Generated from API version 2022-03-03 +// Generated from API version 2022-08-03 // - location - Resource location. // - galleryUniqueName - The unique name of the Shared Gallery. // - galleryImageName - The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. @@ -175,7 +175,7 @@ func (client *SharedGalleryImageVersionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-03") + reqQP.Set("api-version", "2022-08-03") if options != nil && options.SharedTo != nil { reqQP.Set("sharedTo", string(*options.SharedTo)) } 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 c6f88e70b4e0..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go +++ /dev/null @@ -1,102 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedGalleryImageVersionsClient().NewListPager("myLocation", "galleryUniqueName", "myGalleryImageName", &armcompute.SharedGalleryImageVersionsClientListOptions{SharedTo: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedGalleryImageVersionList = armcompute.SharedGalleryImageVersionList{ - // Value: []*armcompute.SharedGalleryImageVersion{ - // { - // Name: to.Ptr("myGalleryImageVersionName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Properties: &armcompute.SharedGalleryImageVersionProperties{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedGalleryImageVersionsClient().Get(ctx, "myLocation", "galleryUniqueName", "myGalleryImageName", "myGalleryImageVersionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedGalleryImageVersion = armcompute.SharedGalleryImageVersion{ - // Name: to.Ptr("myGalleryImageVersionName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Properties: &armcompute.SharedGalleryImageVersionProperties{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/skus_live_test.go b/sdk/resourcemanager/compute/armcompute/skus_live_test.go deleted file mode 100644 index 89b12f6ec696..000000000000 --- a/sdk/resourcemanager/compute/armcompute/skus_live_test.go +++ /dev/null @@ -1,73 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type SkusTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *SkusTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *SkusTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestSkusTestSuite(t *testing.T) { - suite.Run(t, new(SkusTestSuite)) -} - -// Microsoft.Compute/skus -func (testsuite *SkusTestSuite) TestResourceSkus() { - var err error - // From step ResourceSkus_List - fmt.Println("Call operation: ResourceSKUs_List") - resourceSKUsClient, err := armcompute.NewResourceSKUsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - resourceSKUsClientNewListPager := resourceSKUsClient.NewListPager(&armcompute.ResourceSKUsClientListOptions{ - Filter: to.Ptr("location eq 'westus2'"), - }) - for resourceSKUsClientNewListPager.More() { - _, err := resourceSKUsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } -} diff --git a/sdk/resourcemanager/compute/armcompute/snapshot_live_test.go b/sdk/resourcemanager/compute/armcompute/snapshot_live_test.go deleted file mode 100644 index e664393005d1..000000000000 --- a/sdk/resourcemanager/compute/armcompute/snapshot_live_test.go +++ /dev/null @@ -1,141 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type SnapshotTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - snapshotName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *SnapshotTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.snapshotName = testutil.GenerateAlphaNumericID(testsuite.T(), "snapshotna", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *SnapshotTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestSnapshotTestSuite(t *testing.T) { - suite.Run(t, new(SnapshotTestSuite)) -} - -// Microsoft.Compute/snapshots/{snapshotName} -func (testsuite *SnapshotTestSuite) TestSnapshots() { - var err error - // From step Snapshots_CreateOrUpdate - fmt.Println("Call operation: Snapshots_CreateOrUpdate") - snapshotsClient, err := armcompute.NewSnapshotsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - snapshotsClientCreateOrUpdateResponsePoller, err := snapshotsClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.snapshotName, armcompute.Snapshot{ - Location: to.Ptr(testsuite.location), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](10), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, snapshotsClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step Snapshots_List - fmt.Println("Call operation: Snapshots_List") - snapshotsClientNewListPager := snapshotsClient.NewListPager(nil) - for snapshotsClientNewListPager.More() { - _, err := snapshotsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Snapshots_ListByResourceGroup - fmt.Println("Call operation: Snapshots_ListByResourceGroup") - snapshotsClientNewListByResourceGroupPager := snapshotsClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for snapshotsClientNewListByResourceGroupPager.More() { - _, err := snapshotsClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Snapshots_Get - fmt.Println("Call operation: Snapshots_Get") - _, err = snapshotsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.snapshotName, nil) - testsuite.Require().NoError(err) - - // From step Snapshots_Update - fmt.Println("Call operation: Snapshots_Update") - snapshotsClientUpdateResponsePoller, err := snapshotsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.snapshotName, armcompute.SnapshotUpdate{ - Properties: &armcompute.SnapshotUpdateProperties{ - DiskSizeGB: to.Ptr[int32](20), - }, - Tags: map[string]*string{ - "department": to.Ptr("Development"), - "project": to.Ptr("UpdateSnapshots"), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, snapshotsClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step Snapshots_GrantAccess - fmt.Println("Call operation: Snapshots_GrantAccess") - snapshotsClientGrantAccessResponsePoller, err := snapshotsClient.BeginGrantAccess(testsuite.ctx, testsuite.resourceGroupName, testsuite.snapshotName, armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, snapshotsClientGrantAccessResponsePoller) - testsuite.Require().NoError(err) - - // From step Snapshots_RevokeAccess - fmt.Println("Call operation: Snapshots_RevokeAccess") - snapshotsClientRevokeAccessResponsePoller, err := snapshotsClient.BeginRevokeAccess(testsuite.ctx, testsuite.resourceGroupName, testsuite.snapshotName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, snapshotsClientRevokeAccessResponsePoller) - testsuite.Require().NoError(err) - - // From step Snapshots_Delete - fmt.Println("Call operation: Snapshots_Delete") - snapshotsClientDeleteResponsePoller, err := snapshotsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.snapshotName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, snapshotsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} 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 cec355140bfc..000000000000 --- a/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go +++ /dev/null @@ -1,697 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot1"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot1"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot2"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot2"), - // 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"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("UpdateSnapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // DiskSizeGB: to.Ptr[int32](20), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("UpdateSnapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // DiskSizeGB: to.Ptr[int32](20), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSnapshotsClient().Get(ctx, "myResourceGroup", "mySnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // SourceUniqueID: to.Ptr("d633885d-d102-4481-901e-5b2413d1a7be"), - // }, - // DiskSizeGB: to.Ptr[int32](100), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("test_sku"), - // Product: to.Ptr("marketplace_vm_test"), - // Publisher: to.Ptr("test_test_pmc2pc1"), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // SupportsHibernation: to.Ptr(true), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSnapshotsClient().Get(ctx, "myResourceGroup", "myIncrementalSnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("myIncrementalSnapshot"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/myIncrementalSnapshot"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // SourceUniqueID: to.Ptr("d633885d-d102-4481-901e-5b2413d1a7be"), - // }, - // DiskSizeBytes: to.Ptr[int64](10737418240), - // DiskSizeGB: to.Ptr[int32](100), - // DiskState: to.Ptr(armcompute.DiskState("0")), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Incremental: to.Ptr(true), - // IncrementalSnapshotFamilyID: to.Ptr("d1a341d5-1ea7-4a85-b304-944ad8021639"), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicy("0")), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("test_sku"), - // Product: to.Ptr("marketplace_vm_test"), - // Publisher: to.Ptr("test_test_pmc2pc1"), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // SupportsHibernation: to.Ptr(true), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079872+00:00"); return t}()), - // UniqueID: to.Ptr("a395e9c1-fb9e-446e-a9ba-7b2fa0bcd305"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSnapshotsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SnapshotList = armcompute.SnapshotList{ - // Value: []*armcompute.Snapshot{ - // { - // Name: to.Ptr("mySnapshot"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.9278721+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSnapshotsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SnapshotList = armcompute.SnapshotList{ - // Value: []*armcompute.Snapshot{ - // { - // Name: to.Ptr("mySnapshot1"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:47:30.6630569+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("mySnapshot2"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // 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/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // 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"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:47:30.3247198+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().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/sshpublickey_live_test.go b/sdk/resourcemanager/compute/armcompute/sshpublickey_live_test.go deleted file mode 100644 index 3b5dc535b395..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sshpublickey_live_test.go +++ /dev/null @@ -1,113 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type SshPublicKeyTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - sshPublicKeyName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *SshPublicKeyTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.sshPublicKeyName = testutil.GenerateAlphaNumericID(testsuite.T(), "sshpublick", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *SshPublicKeyTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestSshPublicKeyTestSuite(t *testing.T) { - suite.Run(t, new(SshPublicKeyTestSuite)) -} - -// Microsoft.Compute/sshPublicKeys/{sshPublicKeyName} -func (testsuite *SshPublicKeyTestSuite) TestSshPublicKeys() { - var err error - // From step SshPublicKeys_Create - fmt.Println("Call operation: SSHPublicKeys_Create") - sSHPublicKeysClient, err := armcompute.NewSSHPublicKeysClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = sSHPublicKeysClient.Create(testsuite.ctx, testsuite.resourceGroupName, testsuite.sshPublicKeyName, armcompute.SSHPublicKeyResource{ - Location: to.Ptr(testsuite.location), - }, nil) - testsuite.Require().NoError(err) - - // From step SshPublicKeys_ListBySubscription - fmt.Println("Call operation: SSHPublicKeys_ListBySubscription") - sSHPublicKeysClientNewListBySubscriptionPager := sSHPublicKeysClient.NewListBySubscriptionPager(nil) - for sSHPublicKeysClientNewListBySubscriptionPager.More() { - _, err := sSHPublicKeysClientNewListBySubscriptionPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step SshPublicKeys_ListByResourceGroup - fmt.Println("Call operation: SSHPublicKeys_ListByResourceGroup") - sSHPublicKeysClientNewListByResourceGroupPager := sSHPublicKeysClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for sSHPublicKeysClientNewListByResourceGroupPager.More() { - _, err := sSHPublicKeysClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step SshPublicKeys_Get - fmt.Println("Call operation: SSHPublicKeys_Get") - _, err = sSHPublicKeysClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.sshPublicKeyName, nil) - testsuite.Require().NoError(err) - - // From step SshPublicKeys_Update - fmt.Println("Call operation: SSHPublicKeys_Update") - _, err = sSHPublicKeysClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.sshPublicKeyName, armcompute.SSHPublicKeyUpdateResource{ - Tags: map[string]*string{ - "key2854": to.Ptr("a"), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step SshPublicKeys_GenerateKeyPair - fmt.Println("Call operation: SSHPublicKeys_GenerateKeyPair") - _, err = sSHPublicKeysClient.GenerateKeyPair(testsuite.ctx, testsuite.resourceGroupName, testsuite.sshPublicKeyName, nil) - testsuite.Require().NoError(err) - - // From step SshPublicKeys_Delete - fmt.Println("Call operation: SSHPublicKeys_Delete") - _, err = sSHPublicKeysClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.sshPublicKeyName, nil) - testsuite.Require().NoError(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 3b4260322fbd..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go +++ /dev/null @@ -1,349 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // Name: to.Ptr("mySshPublicKeyName"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key6396": to.Ptr("aaaaaaaaaaaaa"), - // "key8839": to.Ptr("aaa"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // Name: to.Ptr("mySshPublicKeyName"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key6396": to.Ptr("aaaaaaaaaaaaa"), - // "key8839": to.Ptr("aaa"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Name: to.Ptr("mySshPublicKeyName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Name: to.Ptr("mySshPublicKeyName"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key6396": to.Ptr("aaaaaaaaaaaaa"), - // "key8839": to.Ptr("aaa"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.SSHPublicKeyUpdateResource{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSSHPublicKeysClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSSHPublicKeysClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().Get(ctx, "myResourceGroup", "mySshPublicKeyName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Name: to.Ptr("mySshPublicKeyName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/SshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().GenerateKeyPair(ctx, "myResourceGroup", "mySshPublicKeyName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyGenerateKeyPairResult = armcompute.SSHPublicKeyGenerateKeyPairResult{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/SshPublicKeys/mySshPublicKeyName"), - // PrivateKey: to.Ptr("{ssh private key}"), - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // } -} 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 5318c8bb4474..000000000000 --- a/sdk/resourcemanager/compute/armcompute/usage_client_example_test.go +++ /dev/null @@ -1,90 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageClient().NewListPager("4_.", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListUsagesResult = armcompute.ListUsagesResult{ - // Value: []*armcompute.Usage{ - // { - // Name: &armcompute.UsageName{ - // LocalizedValue: to.Ptr("aaaaaaaaaaaaaa"), - // Value: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // CurrentValue: to.Ptr[int32](17), - // Limit: to.Ptr[int64](19), - // Unit: to.Ptr("Count"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageClient().NewListPager("_--", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListUsagesResult = armcompute.ListUsagesResult{ - // Value: []*armcompute.Usage{ - // { - // Name: &armcompute.UsageName{ - // }, - // CurrentValue: to.Ptr[int32](17), - // Limit: to.Ptr[int64](19), - // Unit: to.Ptr("Count"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachine_live_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachine_live_test.go deleted file mode 100644 index 987606b16747..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachine_live_test.go +++ /dev/null @@ -1,348 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/stretchr/testify/suite" -) - -type VirtualMachineTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - adminUsername string - networkInterfaceId string - networkInterfaceName string - virtualNetworksName string - vmName string - adminPassword string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *VirtualMachineTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.adminUsername = testutil.GenerateAlphaNumericID(testsuite.T(), "vmuserna", 6) - testsuite.networkInterfaceName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmnic", 6) - testsuite.virtualNetworksName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmvnet", 6) - testsuite.vmName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmname", 6) - testsuite.adminPassword = testutil.GetEnv("ADMIN_PASSWORD", "") - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *VirtualMachineTestSuite) TearDownSuite() { - testsuite.Cleanup() - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestVirtualMachineTestSuite(t *testing.T) { - suite.Run(t, new(VirtualMachineTestSuite)) -} - -func (testsuite *VirtualMachineTestSuite) Prepare() { - var err error - // From step Create_NetworkInterface - template := map[string]any{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]any{ - "networkInterfaceId": map[string]any{ - "type": "string", - "value": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]", - }, - }, - "parameters": map[string]any{ - "location": map[string]any{ - "type": "string", - "defaultValue": testsuite.location, - }, - "networkInterfaceName": map[string]any{ - "type": "string", - "defaultValue": testsuite.networkInterfaceName, - }, - "virtualNetworksName": map[string]any{ - "type": "string", - "defaultValue": testsuite.virtualNetworksName, - }, - }, - "resources": []any{ - map[string]any{ - "name": "[parameters('virtualNetworksName')]", - "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2021-05-01", - "location": "[parameters('location')]", - "properties": map[string]any{ - "addressSpace": map[string]any{ - "addressPrefixes": []any{ - "10.0.0.0/16", - }, - }, - "subnets": []any{ - map[string]any{ - "name": "default", - "properties": map[string]any{ - "addressPrefix": "10.0.0.0/24", - }, - }, - }, - }, - }, - map[string]any{ - "name": "[parameters('networkInterfaceName')]", - "type": "Microsoft.Network/networkInterfaces", - "apiVersion": "2021-08-01", - "dependsOn": []any{ - "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworksName'))]", - }, - "location": "[parameters('location')]", - "properties": map[string]any{ - "ipConfigurations": []any{ - map[string]any{ - "name": "Ipv4config", - "properties": map[string]any{ - "subnet": map[string]any{ - "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworksName'), 'default')]", - }, - }, - }, - }, - }, - }, - }, - } - deployment := armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err := testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "Create_NetworkInterface", &deployment) - testsuite.Require().NoError(err) - testsuite.networkInterfaceId = deploymentExtend.Properties.Outputs.(map[string]interface{})["networkInterfaceId"].(map[string]interface{})["value"].(string) - - // From step VirtualMachines_CreateOrUpdate - fmt.Println("Call operation: VirtualMachines_CreateOrUpdate") - virtualMachinesClient, err := armcompute.NewVirtualMachinesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachinesClientCreateOrUpdateResponsePoller, err := virtualMachinesClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, armcompute.VirtualMachine{ - Location: to.Ptr(testsuite.location), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr(testsuite.networkInterfaceId), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr(testsuite.adminPassword), - AdminUsername: to.Ptr(testsuite.adminUsername), - ComputerName: to.Ptr(testsuite.vmName), - }, - 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(testsuite.vmName + "osdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/virtualMachines/{vmName} -func (testsuite *VirtualMachineTestSuite) TestVirtualMachines() { - var err error - // From step VirtualMachines_ListByLocation - fmt.Println("Call operation: VirtualMachines_ListByLocation") - virtualMachinesClient, err := armcompute.NewVirtualMachinesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachinesClientNewListByLocationPager := virtualMachinesClient.NewListByLocationPager(testsuite.location, nil) - for virtualMachinesClientNewListByLocationPager.More() { - _, err := virtualMachinesClientNewListByLocationPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachines_InstanceView - fmt.Println("Call operation: VirtualMachines_InstanceView") - _, err = virtualMachinesClient.InstanceView(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, nil) - testsuite.Require().NoError(err) - - // From step VirtualMachines_ListAll - fmt.Println("Call operation: VirtualMachines_ListAll") - virtualMachinesClientNewListAllPager := virtualMachinesClient.NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: nil, - Filter: nil, - }) - for virtualMachinesClientNewListAllPager.More() { - _, err := virtualMachinesClientNewListAllPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachines_List - fmt.Println("Call operation: VirtualMachines_List") - virtualMachinesClientNewListPager := virtualMachinesClient.NewListPager(testsuite.resourceGroupName, &armcompute.VirtualMachinesClientListOptions{Filter: nil}) - for virtualMachinesClientNewListPager.More() { - _, err := virtualMachinesClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachines_Get - fmt.Println("Call operation: VirtualMachines_Get") - _, err = virtualMachinesClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)}) - testsuite.Require().NoError(err) - - // From step VirtualMachines_ListAvailableSizes - fmt.Println("Call operation: VirtualMachines_ListAvailableSizes") - virtualMachinesClientNewListAvailableSizesPager := virtualMachinesClient.NewListAvailableSizesPager(testsuite.resourceGroupName, testsuite.vmName, nil) - for virtualMachinesClientNewListAvailableSizesPager.More() { - _, err := virtualMachinesClientNewListAvailableSizesPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachines_Update - fmt.Println("Call operation: VirtualMachines_Update") - virtualMachinesClientUpdateResponsePoller, err := virtualMachinesClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, armcompute.VirtualMachineUpdate{ - Tags: map[string]*string{ - "virtaulMachine": to.Ptr("vmupdate"), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachines_InstallPatches - fmt.Println("Call operation: VirtualMachines_InstallPatches") - virtualMachinesClientInstallPatchesResponsePoller, err := virtualMachinesClient.BeginInstallPatches(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, 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)}, - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientInstallPatchesResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachines_Deallocate - fmt.Println("Call operation: VirtualMachines_Deallocate") - virtualMachinesClientDeallocateResponsePoller, err := virtualMachinesClient.BeginDeallocate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, &armcompute.VirtualMachinesClientBeginDeallocateOptions{Hibernate: nil}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientDeallocateResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachines_Start - fmt.Println("Call operation: VirtualMachines_Start") - virtualMachinesClientStartResponsePoller, err := virtualMachinesClient.BeginStart(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientStartResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachines_AssessPatches - fmt.Println("Call operation: VirtualMachines_AssessPatches") - virtualMachinesClientAssessPatchesResponsePoller, err := virtualMachinesClient.BeginAssessPatches(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientAssessPatchesResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachines_Restart - fmt.Println("Call operation: VirtualMachines_Restart") - virtualMachinesClientRestartResponsePoller, err := virtualMachinesClient.BeginRestart(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientRestartResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachines_Reapply - fmt.Println("Call operation: VirtualMachines_Reapply") - virtualMachinesClientReapplyResponsePoller, err := virtualMachinesClient.BeginReapply(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientReapplyResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachines_RunCommand - fmt.Println("Call operation: VirtualMachines_RunCommand") - virtualMachinesClientRunCommandResponsePoller, err := virtualMachinesClient.BeginRunCommand(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, armcompute.RunCommandInput{ - CommandID: to.Ptr("RunPowerShellScript"), - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientRunCommandResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachines_Redeploy - fmt.Println("Call operation: VirtualMachines_Redeploy") - virtualMachinesClientRedeployResponsePoller, err := virtualMachinesClient.BeginRedeploy(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientRedeployResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachines_PowerOff - fmt.Println("Call operation: VirtualMachines_PowerOff") - virtualMachinesClientPowerOffResponsePoller, err := virtualMachinesClient.BeginPowerOff(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, &armcompute.VirtualMachinesClientBeginPowerOffOptions{SkipShutdown: nil}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientPowerOffResponsePoller) - testsuite.Require().NoError(err) -} - -func (testsuite *VirtualMachineTestSuite) Cleanup() { - var err error - // From step VirtualMachines_Delete - fmt.Println("Call operation: VirtualMachines_Delete") - virtualMachinesClient, err := armcompute.NewVirtualMachinesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachinesClientDeleteResponsePoller, err := virtualMachinesClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmName, &armcompute.VirtualMachinesClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachinesClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimage_live_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimage_live_test.go deleted file mode 100644 index c67c58321675..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimage_live_test.go +++ /dev/null @@ -1,82 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type VirtualMachineExtensionImageTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *VirtualMachineExtensionImageTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *VirtualMachineExtensionImageTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestVirtualMachineExtensionImageTestSuite(t *testing.T) { - suite.Run(t, new(VirtualMachineExtensionImageTestSuite)) -} - -// Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types -func (testsuite *VirtualMachineExtensionImageTestSuite) TestVirtualMachineExtensionImages() { - publisherName := "Microsoft.Compute" - typeParam := "CustomScriptExtension" - version := "1.9" - var err error - // From step VirtualMachineExtensionImages_ListTypes - fmt.Println("Call operation: VirtualMachineExtensionImages_ListTypes") - virtualMachineExtensionImagesClient, err := armcompute.NewVirtualMachineExtensionImagesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = virtualMachineExtensionImagesClient.ListTypes(testsuite.ctx, testsuite.location, publisherName, nil) - testsuite.Require().NoError(err) - - // From step VirtualMachineExtensionImages_ListVersions - fmt.Println("Call operation: VirtualMachineExtensionImages_ListVersions") - _, err = virtualMachineExtensionImagesClient.ListVersions(testsuite.ctx, testsuite.location, publisherName, typeParam, &armcompute.VirtualMachineExtensionImagesClientListVersionsOptions{Filter: nil, - Top: nil, - Orderby: nil, - }) - testsuite.Require().NoError(err) - - // From step VirtualMachineExtensionImages_Get - fmt.Println("Call operation: VirtualMachineExtensionImages_Get") - _, err = virtualMachineExtensionImagesClient.Get(testsuite.ctx, testsuite.location, publisherName, typeParam, version, nil) - testsuite.Require().NoError(err) -} 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 dfabe5b0049b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go +++ /dev/null @@ -1,209 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().Get(ctx, "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImage = armcompute.VirtualMachineExtensionImage{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9885": to.Ptr("aaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionImageProperties{ - // ComputeRole: to.Ptr("aaaaaaaaaaaaaaaaa"), - // HandlerSchema: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // OperatingSystem: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // SupportsMultipleExtensions: to.Ptr(true), - // VMScaleSetEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().Get(ctx, "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", "aaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImage = armcompute.VirtualMachineExtensionImage{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().ListTypes(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9885": to.Ptr("aaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionImageProperties{ - // ComputeRole: to.Ptr("aaaaaaaaaaaaaaaaa"), - // HandlerSchema: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // OperatingSystem: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // SupportsMultipleExtensions: to.Ptr(true), - // VMScaleSetEnabled: to.Ptr(true), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().ListTypes(ctx, "aaaa", "aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9885": to.Ptr("aaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionImageProperties{ - // ComputeRole: to.Ptr("aaaaaaaaaaaaaaaaa"), - // HandlerSchema: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // OperatingSystem: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // SupportsMultipleExtensions: to.Ptr(true), - // VMScaleSetEnabled: to.Ptr(true), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // }} -} 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 bdde2f41def5..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go +++ /dev/null @@ -1,437 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().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]any{}, - Publisher: to.Ptr("extPublisher"), - Settings: map[string]any{}, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // 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]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().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]any{ - "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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // 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"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", &armcompute.VirtualMachineExtensionsClientGetOptions{Expand: to.Ptr("aaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // 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]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().Get(ctx, "rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().List(ctx, "rgcompute", "aaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionsListResult = armcompute.VirtualMachineExtensionsListResult{ - // Value: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // 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]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().List(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionsListResult = armcompute.VirtualMachineExtensionsListResult{ - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineimage_live_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimage_live_test.go deleted file mode 100644 index 8d2d799af082..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimage_live_test.go +++ /dev/null @@ -1,93 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type VirtualMachineImageTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *VirtualMachineImageTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *VirtualMachineImageTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestVirtualMachineImageTestSuite(t *testing.T) { - suite.Run(t, new(VirtualMachineImageTestSuite)) -} - -// Microsoft.Compute/locations/publishers -func (testsuite *VirtualMachineImageTestSuite) TestVirtualMachineImages() { - offer := "office-365" - publisherName := "MicrosoftWindowsDesktop" - skus := "win11-22h2-avd-m365" - version := "22621.1105.230110" - var err error - // From step VirtualMachineImages_ListPublishers - fmt.Println("Call operation: VirtualMachineImages_ListPublishers") - virtualMachineImagesClient, err := armcompute.NewVirtualMachineImagesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = virtualMachineImagesClient.ListPublishers(testsuite.ctx, testsuite.location, nil) - testsuite.Require().NoError(err) - - // From step VirtualMachineImages_ListOffers - fmt.Println("Call operation: VirtualMachineImages_ListOffers") - _, err = virtualMachineImagesClient.ListOffers(testsuite.ctx, testsuite.location, publisherName, nil) - testsuite.Require().NoError(err) - - // From step VirtualMachineImages_ListSkus - fmt.Println("Call operation: VirtualMachineImages_ListSKUs") - _, err = virtualMachineImagesClient.ListSKUs(testsuite.ctx, testsuite.location, publisherName, offer, nil) - testsuite.Require().NoError(err) - - // From step VirtualMachineImages_List - fmt.Println("Call operation: VirtualMachineImages_List") - _, err = virtualMachineImagesClient.List(testsuite.ctx, testsuite.location, publisherName, offer, skus, &armcompute.VirtualMachineImagesClientListOptions{Expand: nil, - Top: nil, - Orderby: nil, - }) - testsuite.Require().NoError(err) - - // From step VirtualMachineImages_Get - fmt.Println("Call operation: VirtualMachineImages_Get") - _, err = virtualMachineImagesClient.Get(testsuite.ctx, testsuite.location, publisherName, offer, skus, version, nil) - testsuite.Require().NoError(err) -} 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 8b98e1bd52ad..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go +++ /dev/null @@ -1,403 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().Get(ctx, "aaaaaa", "aaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaa"), - // Tags: map[string]*string{ - // "key6817": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineImageProperties{ - // AutomaticOSUpgradeProperties: &armcompute.AutomaticOSUpgradeProperties{ - // AutomaticOSUpgradeSupported: to.Ptr(true), - // }, - // DataDiskImages: []*armcompute.DataDiskImage{ - // { - // Lun: to.Ptr[int32](17), - // }}, - // Disallowed: &armcompute.DisallowedConfiguration{ - // VMDiskType: to.Ptr(armcompute.VMDiskTypesNone), - // }, - // Features: []*armcompute.VirtualMachineImageFeature{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Value: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypesV1), - // ImageDeprecationStatus: &armcompute.ImageDeprecationStatus{ - // AlternativeOption: &armcompute.AlternativeOption{ - // Type: to.Ptr(armcompute.AlternativeTypeOffer), - // Value: to.Ptr("aaaaaaa"), - // }, - // ImageState: to.Ptr(armcompute.ImageStateScheduledForDeprecation), - // ScheduledDeprecationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-13T00:00:00+00:00"); return t}()), - // }, - // OSDiskImage: &armcompute.OSDiskImage{ - // OperatingSystem: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // Plan: &armcompute.PurchasePlan{ - // Name: to.Ptr("aaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().Get(ctx, "aaaaaaaaaaaa", "aaaaaaaaaaa", "aa", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // Name: to.Ptr("aaaaaaaaa"), - // Location: to.Ptr("aaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListOffers(ctx, "aaaaaaa", "aaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListOffers(ctx, "aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListPublishers(ctx, "aaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListPublishers(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListSKUs(ctx, "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListSKUs(ctx, "aaaa", "aaaaaaaaaaaaa", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListByEdgeZone(ctx, "WestUS", "microsoftlosangeles1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMImagesInEdgeZoneListResult = armcompute.VMImagesInEdgeZoneListResult{ - // Value: []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("/Subscriptions/5ece5940-d962-4dad-a98f-ca9ac0f021a5/Providers/Microsoft.Compute/Locations/westus/Publishers/CANONICAL/ArtifactTypes/VMImage/Offers/UBUNTUSERVER/Skus/18_04-LTS-GEN2/Versions/18.04.202107200"), - // Name: to.Ptr("18.04.202107200"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("microsoftlosangeles1"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("WestUS"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListByEdgeZone(ctx, "WestUS", "microsoftlosangeles1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMImagesInEdgeZoneListResult = armcompute.VMImagesInEdgeZoneListResult{ - // Value: []*armcompute.VirtualMachineImageResource{ - // }, - // } -} 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 606c685ad7bd..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go +++ /dev/null @@ -1,339 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().Get(ctx, "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaa"), - // Tags: map[string]*string{ - // "key6817": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineImageProperties{ - // AutomaticOSUpgradeProperties: &armcompute.AutomaticOSUpgradeProperties{ - // AutomaticOSUpgradeSupported: to.Ptr(true), - // }, - // DataDiskImages: []*armcompute.DataDiskImage{ - // { - // Lun: to.Ptr[int32](17), - // }}, - // Disallowed: &armcompute.DisallowedConfiguration{ - // VMDiskType: to.Ptr(armcompute.VMDiskTypesNone), - // }, - // Features: []*armcompute.VirtualMachineImageFeature{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Value: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypesV1), - // OSDiskImage: &armcompute.OSDiskImage{ - // OperatingSystem: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // Plan: &armcompute.PurchasePlan{ - // Name: to.Ptr("aaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().Get(ctx, "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // Name: to.Ptr("aaaaaaaaa"), - // Location: to.Ptr("aaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListOffers(ctx, "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListOffers(ctx, "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListPublishers(ctx, "aaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListPublishers(ctx, "aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListSKUs(ctx, "aaaaaaaaaaaa", "aaaaa", "aaaaaaaaaaaa", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListSKUs(ctx, "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaa", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} 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 66a0ce2ebc3c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go +++ /dev/null @@ -1,416 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineRunCommandsClient().NewListPager("SoutheastAsia", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RunCommandListResult = armcompute.RunCommandListResult{ - // Value: []*armcompute.RunCommandDocumentBase{ - // { - // Description: to.Ptr("Configure the machine to enable remote PowerShell."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("EnableRemotePS"), - // Label: to.Ptr("Enable remote PowerShell"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Shows detailed information for the IP address, subnet mask and default gateway for each adapter bound to TCP/IP."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("IPConfig"), - // Label: to.Ptr("List IP configuration"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Custom multiline PowerShell script should be defined in script property. Optional parameters can be set in parameters property."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RunPowerShellScript"), - // Label: to.Ptr("Executes a PowerShell script"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Custom multiline shell script should be defined in script property. Optional parameters can be set in parameters property."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RunShellScript"), - // Label: to.Ptr("Executes a Linux shell script"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // { - // Description: to.Ptr("Get the configuration of all network interfaces."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("ifconfig"), - // Label: to.Ptr("List network configuration"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // { - // Description: to.Ptr("Checks if the local Administrator account is disabled, and if so enables it."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("EnableAdminAccount"), - // Label: to.Ptr("Enable administrator account"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Reset built-in Administrator account password."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("ResetAccountPassword"), - // Label: to.Ptr("Reset built-in Administrator account password"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Checks registry settings and domain policy settings. Suggests policy actions if machine is part of a domain or modifies the settings to default values."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RDPSettings"), - // Label: to.Ptr("Verify RDP Listener Settings"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Sets the default or user specified port number for Remote Desktop connections. Enables firewall rule for inbound access to the port."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("SetRDPPort"), - // Label: to.Ptr("Set Remote Desktop port"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Removes the SSL certificate tied to the RDP listener and restores the RDP listerner security to default. Use this script if you see any issues with the certificate."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("ResetRDPCert"), - // Label: to.Ptr("Restore RDP Authentication mode to defaults"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineRunCommandsClient().Get(ctx, "SoutheastAsia", "RunPowerShellScript", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RunCommandDocument = armcompute.RunCommandDocument{ - // Description: to.Ptr("Custom multiline PowerShell script should be defined in script property. Optional parameters can be set in parameters property."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RunPowerShellScript"), - // Label: to.Ptr("Executes a PowerShell script"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Parameters: []*armcompute.RunCommandParameterDefinition{ - // { - // Name: to.Ptr("arg1"), - // Type: to.Ptr("string"), - // DefaultValue: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("arg2"), - // Type: to.Ptr("string"), - // DefaultValue: to.Ptr("value2"), - // }}, - // Script: []*string{ - // to.Ptr("param("), - // to.Ptr(" [string]$arg1,"), - // to.Ptr(" [string]$arg2"), - // to.Ptr(")"), - // to.Ptr("Write-Host This is a sample script with parameters $arg1 $arg2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineRunCommandsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // 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"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineRunCommandsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // 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"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Script Source Updated!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineRunCommandsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineRunCommandsClient().GetByVirtualMachine(ctx, "myResourceGroup", "myVM", "myRunCommand", &armcompute.VirtualMachineRunCommandsClientGetByVirtualMachineOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // 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"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineRunCommandsClient().NewListByVirtualMachinePager("myResourceGroup", "myVM", &armcompute.VirtualMachineRunCommandsClientListByVirtualMachineOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineRunCommandsListResult = armcompute.VirtualMachineRunCommandsListResult{ - // Value: []*armcompute.VirtualMachineRunCommand{ - // { - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // 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"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](0), - // }, - // }}, - // } - } -} 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 e5612e63ab35..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go +++ /dev/null @@ -1,9120 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListByLocationPager("eastus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "RG": to.Ptr("rg"), - // "testTag": to.Ptr("1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](127), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // }, - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "RG": to.Ptr("rg"), - // "testTag": to.Ptr("1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](127), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineCaptureResult = armcompute.VirtualMachineCaptureResult{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Schema: to.Ptr("aaaaa"), - // ContentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Parameters: map[string]any{ - // }, - // Resources: []any{ - // map[string]any{ - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineCaptureResult = armcompute.VirtualMachineCaptureResult{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // 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), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // PatchSettings: &armcompute.LinuxPatchSettings{ - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // 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), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("{vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/{vm-name}"), - // 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://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("{vm-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("{vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/{vm-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("{vm-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/toBeCreatedNetworkInterface"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByOS), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // 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), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{existing-storage-account-name}.blob.core.windows.net/system/Microsoft.Compute/Images/vhds/{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/vhds/myDisk.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("926cd555-a07c-4ff5-b214-4aa4dd09d79b"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("dataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // 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/vhds/myDisk0.vhd"), - // }, - // }, - // { - // Name: to.Ptr("dataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // 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/vhds/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), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/vhds/myDisk.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("5230a749-2f68-4830-900b-702182d32e63"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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), - // }, - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myExistingFlexVmss"), - // }, - // VMID: to.Ptr("7cce54f2-ecd3-4ddd-a8d9-50984faa3918"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/NSGEXISTINGAS"), - // }, - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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"), - // 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"), - // }, - // { - // 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/nsgExistingNic"), - // 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"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("e0de9b84-a506-4b95-9623-00a425d05c90"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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/nsgcustom"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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{ - OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT15M"), - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT10M"), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("3906fef9-a1e5-4b83-a8a8-540858b41df0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("b248db33-62ba-4d2d-b791-811e075ee0f5"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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{ - // 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"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("e0de9b84-a506-4b95-9623-00a425d05c90"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(true), - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("3906fef9-a1e5-4b83-a8a8-540858b41df0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // 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/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(true), - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("3906fef9-a1e5-4b83-a8a8-540858b41df0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/my-AvailabilitySet"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://{myStorageAccount}.blob.core.windows.net"), - // }, - // }, - // ExtensionsTimeBudget: to.Ptr("PT50M"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS3V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/my-ppg01"), - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("myDataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk0"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("myDataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("west us"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/my-AvailabilitySet"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://{myStorageAccount}.blob.core.windows.net"), - // }, - // }, - // ExtensionsTimeBudget: to.Ptr("PT50M"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS3V2), - // 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/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("myDataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk0"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("myDataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("west us"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/my-AvailabilitySet"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://{myStorageAccount}.blob.core.windows.net"), - // }, - // }, - // ExtensionsTimeBudget: to.Ptr("PT50M"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS3V2), - // 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/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("myDataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk0"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("myDataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // 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("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("west us"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().InstanceView(ctx, "myResourceGroup", "myVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstanceView = armcompute.VirtualMachineInstanceView{ - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("https://{myStorageAccount}.blob.core.windows.net/bootdiagnostics-myOsDisk/myOsDisk.screenshot.bmp"), - // SerialConsoleLogBlobURI: to.Ptr("https://{myStorageAccount}.blob.core.windows.net/bootdiagnostics-myOsDisk/myOsDisk.serialconsole.log"), - // }, - // ComputerName: to.Ptr("myVM"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("myOsDisk"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T21:29:47.477089+00:00"); return t}()), - // }}, - // }, - // { - // Name: to.Ptr("myDataDisk0"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T21:29:47.461517+00:00"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // OSName: to.Ptr("Windows Server 2016 Datacenter"), - // OSVersion: to.Ptr("Microsoft Windows NT 10.0.14393.0"), - // PatchStatus: &armcompute.VirtualMachinePatchStatus{ - // AvailablePatchSummary: &armcompute.AvailablePatchSummary{ - // AssessmentActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // CriticalAndSecurityPatchCount: to.Ptr[int32](1), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // OtherPatchCount: to.Ptr[int32](2), - // RebootPending: to.Ptr(true), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // }, - // ConfigurationStatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("PatchModeConfigurationState/Ready"), - // DisplayStatus: to.Ptr("Status_PatchModeConfigurationState_Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // }, - // { - // Code: to.Ptr("AssessmentModeConfigurationState/Pending"), - // DisplayStatus: to.Ptr("Status_AssessmentModeConfigurationState_Pending"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // }}, - // LastPatchInstallationSummary: &armcompute.LastPatchInstallationSummary{ - // ExcludedPatchCount: to.Ptr[int32](1), - // FailedPatchCount: to.Ptr[int32](1), - // InstallationActivityID: to.Ptr("68f8b292-dfc2-4646-9981-33cc88631968"), - // InstalledPatchCount: to.Ptr[int32](1), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // MaintenanceWindowExceeded: to.Ptr(false), - // NotSelectedPatchCount: to.Ptr[int32](1), - // PendingPatchCount: to.Ptr[int32](1), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](1), - // PlatformUpdateDomain: to.Ptr[int32](1), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T21:30:12.8051917+00:00"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/running"), - // DisplayStatus: to.Ptr("VM running"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - // { - // Type: to.Ptr("Microsoft.Azure.Security.IaaSAntimalware"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // TypeHandlerVersion: to.Ptr("1.5.5.9"), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("GuestAgent is running and accepting new configurations."), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T23:11:22+00:00"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("2.7.41491.949"), - // }, - // Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - // { - // Name: to.Ptr("IaaSAntiMalware-ext0"), - // Type: to.Ptr("Microsoft.Azure.Security.IaaSAntimalware"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("Microsoft Antimalware enabled"), - // }}, - // TypeHandlerVersion: to.Ptr("1.5.5.9"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().InstanceView(ctx, "myResourceGroup", "myVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstanceView = armcompute.VirtualMachineInstanceView{ - // AssignedHost: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup/hosts/myHost"), - // ComputerName: to.Ptr("myVM"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("myOsDisk"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T21:29:47.477089+00:00"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // OSName: to.Ptr("Windows Server 2016 Datacenter"), - // OSVersion: to.Ptr("Microsoft Windows NT 10.0.14393.0"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T21:30:12.8051917+00:00"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/running"), - // DisplayStatus: to.Ptr("VM running"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("GuestAgent is running and accepting new configurations."), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T23:11:22+00:00"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("2.7.41491.949"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListPager("rgcompute", &armcompute.VirtualMachinesClientListOptions{Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // 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("aaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // 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/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](8), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // 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.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaa"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // 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("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // 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/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // 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), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // UserData: to.Ptr("aaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // 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"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // InstanceView: &armcompute.VirtualMachineInstanceView{ - // AssignedHost: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // }, - // ComputerName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("a"), - // EncryptionSettings: []*armcompute.DiskEncryptionSettings{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // MaintenanceRedeployStatus: &armcompute.MaintenanceRedeployStatus{ - // IsCustomerInitiatedMaintenanceAllowed: to.Ptr(true), - // LastOperationMessage: to.Ptr("aa"), - // LastOperationResultCode: to.Ptr(armcompute.MaintenanceOperationResultCodeTypesNone), - // MaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // MaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // PreMaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // PreMaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // }, - // OSName: to.Ptr("aaaaaaaaaaa"), - // OSVersion: to.Ptr("aaaaaaaaaaaaaa"), - // PatchStatus: &armcompute.VirtualMachinePatchStatus{ - // AvailablePatchSummary: &armcompute.AvailablePatchSummary{ - // AssessmentActivityID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // CriticalAndSecurityPatchCount: to.Ptr[int32](22), - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaa"), - // Target: to.Ptr("aaaaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aaaaaaaaaaaaa"), - // Target: to.Ptr("aaaaaa"), - // }}, - // }, - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // OtherPatchCount: to.Ptr[int32](25), - // RebootPending: to.Ptr(true), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusUnknown), - // }, - // ConfigurationStatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // LastPatchInstallationSummary: &armcompute.LastPatchInstallationSummary{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaa"), - // Target: to.Ptr("aaaaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aaaaaaaaaaaaa"), - // Target: to.Ptr("aaaaaa"), - // }}, - // }, - // ExcludedPatchCount: to.Ptr[int32](1), - // FailedPatchCount: to.Ptr[int32](30), - // InstallationActivityID: to.Ptr("aaaaaa"), - // InstalledPatchCount: to.Ptr[int32](28), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // MaintenanceWindowExceeded: to.Ptr(true), - // NotSelectedPatchCount: to.Ptr[int32](20), - // PendingPatchCount: to.Ptr[int32](2), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusUnknown), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](29), - // PlatformUpdateDomain: to.Ptr[int32](1), - // RdpThumbPrint: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - // { - // Type: to.Ptr("aaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // VMHealth: &armcompute.VirtualMachineHealthStatus{ - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // }, - // Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // 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("aaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // 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/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](11), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // 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.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ExactVersion: to.Ptr("aa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // 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("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // 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/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // 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), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.685Z"); return t}()), - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // 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"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListPager("rgcompute", &armcompute.VirtualMachinesClientListOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Location: to.Ptr("eastus"), - // }, - // { - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: to.Ptr("aaaaaa"), - Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // 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("aaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // 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/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](8), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // 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.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaa"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // 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("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // 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/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // 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), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // UserData: to.Ptr("aaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // 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"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // InstanceView: &armcompute.VirtualMachineInstanceView{ - // AssignedHost: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // }, - // ComputerName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("a"), - // EncryptionSettings: []*armcompute.DiskEncryptionSettings{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // MaintenanceRedeployStatus: &armcompute.MaintenanceRedeployStatus{ - // IsCustomerInitiatedMaintenanceAllowed: to.Ptr(true), - // LastOperationMessage: to.Ptr("aa"), - // LastOperationResultCode: to.Ptr(armcompute.MaintenanceOperationResultCodeTypesNone), - // MaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // MaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // PreMaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // PreMaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // }, - // OSName: to.Ptr("aaaaaaaaaaa"), - // OSVersion: to.Ptr("aaaaaaaaaaaaaa"), - // PatchStatus: &armcompute.VirtualMachinePatchStatus{ - // AvailablePatchSummary: &armcompute.AvailablePatchSummary{ - // AssessmentActivityID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // CriticalAndSecurityPatchCount: to.Ptr[int32](22), - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaa"), - // Target: to.Ptr("aaaaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aaaaaaaaaaaaa"), - // Target: to.Ptr("aaaaaa"), - // }}, - // }, - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // OtherPatchCount: to.Ptr[int32](25), - // RebootPending: to.Ptr(true), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusUnknown), - // }, - // ConfigurationStatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // LastPatchInstallationSummary: &armcompute.LastPatchInstallationSummary{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaa"), - // Target: to.Ptr("aaaaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aaaaaaaaaaaaa"), - // Target: to.Ptr("aaaaaa"), - // }}, - // }, - // ExcludedPatchCount: to.Ptr[int32](1), - // FailedPatchCount: to.Ptr[int32](30), - // InstallationActivityID: to.Ptr("aaaaaa"), - // InstalledPatchCount: to.Ptr[int32](28), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // MaintenanceWindowExceeded: to.Ptr(true), - // NotSelectedPatchCount: to.Ptr[int32](20), - // PendingPatchCount: to.Ptr[int32](2), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusUnknown), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](29), - // PlatformUpdateDomain: to.Ptr[int32](1), - // RdpThumbPrint: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - // { - // Type: to.Ptr("aaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // VMHealth: &armcompute.VirtualMachineHealthStatus{ - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // }, - // Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // 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("aaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // 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/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // 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("aaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](11), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // 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.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ExactVersion: to.Ptr("aa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // 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("aaaaaaaaa"), - // 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("aaaaaaaaaaaaa"), - // 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/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // 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), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.685Z"); return t}()), - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // 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"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: nil, - Filter: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Location: to.Ptr("eastus"), - // }, - // { - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListAvailableSizesPager("myResourceGroup", "myVmName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // Value: []*armcompute.VirtualMachineSize{ - // { - // Name: to.Ptr("Standard_A1_V2"), - // MaxDataDiskCount: to.Ptr[int32](2), - // MemoryInMB: to.Ptr[int32](2048), - // NumberOfCores: to.Ptr[int32](1), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](10240), - // }, - // { - // Name: to.Ptr("Standard_A2_V2"), - // MaxDataDiskCount: to.Ptr[int32](4), - // MemoryInMB: to.Ptr[int32](4096), - // NumberOfCores: to.Ptr[int32](2), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](20480), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.json -func ExampleVirtualMachinesClient_BeginReimage_reimageANonEphemeralVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginReimage(ctx, "myResourceGroup", "myVMName", &armcompute.VirtualMachinesClientBeginReimageOptions{Parameters: &armcompute.VirtualMachineReimageParameters{ - ExactVersion: to.Ptr("aaaaaa"), - OSProfile: &armcompute.OSProfileProvisioningData{ - AdminPassword: to.Ptr("{your-password}"), - CustomData: to.Ptr("{your-custom-data}"), - }, - 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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Reimage.json -func ExampleVirtualMachinesClient_BeginReimage_reimageAVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().RetrieveBootDiagnosticsData(ctx, "ResourceGroup", "VMName", &armcompute.VirtualMachinesClientRetrieveBootDiagnosticsDataOptions{SasURIExpirationTimeInMinutes: to.Ptr[int32](60)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RetrieveBootDiagnosticsDataResult = armcompute.RetrieveBootDiagnosticsDataResult{ - // ConsoleScreenshotBlobURI: to.Ptr("https://storageuri/vm.screenshot.bmp?{sasKey}"), - // SerialConsoleLogBlobURI: to.Ptr("https://storageuri/vm.serialconsole.log?{sasKey}"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachinesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineAssessPatchesResult = armcompute.VirtualMachineAssessPatchesResult{ - // AssessmentActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // AvailablePatches: []*armcompute.VirtualMachineSoftwarePatchProperties{ - // { - // Name: to.Ptr("Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.279.1373.0)"), - // ActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // AssessmentState: to.Ptr(armcompute.PatchAssessmentStateAvailable), - // Classifications: []*string{ - // to.Ptr("Definition Updates")}, - // KbID: to.Ptr("2267602"), - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:18:45.2830263Z"); return t}()), - // PatchID: to.Ptr("35428702-5784-4ba4-a6e0-5222258b5411"), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), - // RebootBehavior: to.Ptr(armcompute.VMGuestPatchRebootBehaviorNeverReboots), - // Version: to.Ptr(""), - // }, - // { - // Name: to.Ptr("Windows Malicious Software Removal Tool x64 - October 2018 (KB890830)"), - // ActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // AssessmentState: to.Ptr(armcompute.PatchAssessmentStateAvailable), - // Classifications: []*string{ - // to.Ptr("Update Rollups")}, - // KbID: to.Ptr("890830"), - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:18:45.2830263Z"); return t}()), - // PatchID: to.Ptr("39f9cdd1-795c-4d0e-8c0a-73ab3f31746d"), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), - // RebootBehavior: to.Ptr(armcompute.VMGuestPatchRebootBehaviorCanRequestReboot), - // Version: to.Ptr(""), - // }}, - // CriticalAndSecurityPatchCount: to.Ptr[int32](1), - // OtherPatchCount: to.Ptr[int32](2), - // RebootPending: to.Ptr(true), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstallPatchesResult = armcompute.VirtualMachineInstallPatchesResult{ - // ExcludedPatchCount: to.Ptr[int32](0), - // FailedPatchCount: to.Ptr[int32](0), - // InstallationActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // InstalledPatchCount: to.Ptr[int32](3), - // MaintenanceWindowExceeded: to.Ptr(false), - // NotSelectedPatchCount: to.Ptr[int32](0), - // Patches: []*armcompute.PatchInstallationDetail{ - // { - // Name: to.Ptr("Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.279.1373.0)"), - // Classifications: []*string{ - // to.Ptr("Definition Updates")}, - // InstallationState: to.Ptr(armcompute.PatchInstallationStateInstalled), - // KbID: to.Ptr("2267602"), - // PatchID: to.Ptr("35428702-5784-4ba4-a6e0-5222258b5411"), - // Version: to.Ptr(""), - // }, - // { - // Name: to.Ptr("Windows Malicious Software Removal Tool x64 - October 2018 (KB890830)"), - // Classifications: []*string{ - // to.Ptr("Update Rollups")}, - // InstallationState: to.Ptr(armcompute.PatchInstallationStatePending), - // KbID: to.Ptr("890830"), - // PatchID: to.Ptr("39f9cdd1-795c-4d0e-8c0a-73ab3f31746d"), - // Version: to.Ptr(""), - // }}, - // PendingPatchCount: to.Ptr[int32](2), - // RebootStatus: to.Ptr(armcompute.VMGuestPatchRebootStatusCompleted), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RunCommandResult = armcompute.RunCommandResult{ - // Value: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ComponentStatus/StdOut/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("This is a sample script with parameters value1 value2"), - // }, - // { - // Code: to.Ptr("ComponentStatus/StdErr/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr(""), - // }}, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescaleset_live_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescaleset_live_test.go deleted file mode 100644 index d2e907027f7f..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescaleset_live_test.go +++ /dev/null @@ -1,399 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/stretchr/testify/suite" -) - -type VirtualMachineScaleSetTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - adminUsername string - subnetId string - virtualNetworkSubnetName string - vmScaleSetName string - vmssExtensionName string - adminPassword string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *VirtualMachineScaleSetTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/compute/armcompute/testdata") - - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.adminUsername = testutil.GenerateAlphaNumericID(testsuite.T(), "vmuserna", 6) - testsuite.virtualNetworkSubnetName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmssvnetna", 6) - testsuite.vmScaleSetName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmscaleset", 6) - testsuite.vmssExtensionName = testutil.GenerateAlphaNumericID(testsuite.T(), "vmssextens", 6) - testsuite.adminPassword = testutil.GetEnv("ADMIN_PASSWORD", "") - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *VirtualMachineScaleSetTestSuite) TearDownSuite() { - testsuite.Cleanup() - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestVirtualMachineScaleSetTestSuite(t *testing.T) { - suite.Run(t, new(VirtualMachineScaleSetTestSuite)) -} - -func (testsuite *VirtualMachineScaleSetTestSuite) Prepare() { - var err error - // From step Create_NetworkAndSubnet - template := map[string]any{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]any{ - "subnetId": map[string]any{ - "type": "string", - "value": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkSubnetName'), 'default')]", - }, - }, - "parameters": map[string]any{ - "location": map[string]any{ - "type": "string", - "defaultValue": testsuite.location, - }, - "virtualNetworkSubnetName": map[string]any{ - "type": "string", - "defaultValue": testsuite.virtualNetworkSubnetName, - }, - }, - "resources": []any{ - map[string]any{ - "name": "[parameters('virtualNetworkSubnetName')]", - "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2021-05-01", - "location": "[parameters('location')]", - "properties": map[string]any{ - "addressSpace": map[string]any{ - "addressPrefixes": []any{ - "10.0.0.0/16", - }, - }, - "subnets": []any{ - map[string]any{ - "name": "default", - "properties": map[string]any{ - "addressPrefix": "10.0.0.0/24", - }, - }, - }, - }, - }, - }, - } - deployment := armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err := testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "Create_NetworkAndSubnet", &deployment) - testsuite.Require().NoError(err) - testsuite.subnetId = deploymentExtend.Properties.Outputs.(map[string]interface{})["subnetId"].(map[string]interface{})["value"].(string) - - // From step VirtualMachineScaleSets_CreateOrUpdate - fmt.Println("Call operation: VirtualMachineScaleSets_CreateOrUpdate") - virtualMachineScaleSetsClient, err := armcompute.NewVirtualMachineScaleSetsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachineScaleSetsClientCreateOrUpdateResponsePoller, err := virtualMachineScaleSetsClient.BeginCreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, armcompute.VirtualMachineScaleSet{ - Location: to.Ptr(testsuite.location), - 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(testsuite.vmScaleSetName), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr(testsuite.vmScaleSetName), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr(testsuite.subnetId), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr(testsuite.adminPassword), - AdminUsername: to.Ptr(testsuite.adminUsername), - ComputerNamePrefix: to.Ptr("vmss"), - }, - 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) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientCreateOrUpdateResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName} -func (testsuite *VirtualMachineScaleSetTestSuite) TestVirtualMachineScaleSets() { - var err error - // From step VirtualMachineScaleSets_ListByLocation - fmt.Println("Call operation: VirtualMachineScaleSets_ListByLocation") - virtualMachineScaleSetsClient, err := armcompute.NewVirtualMachineScaleSetsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachineScaleSetsClientNewListByLocationPager := virtualMachineScaleSetsClient.NewListByLocationPager(testsuite.location, nil) - for virtualMachineScaleSetsClientNewListByLocationPager.More() { - _, err := virtualMachineScaleSetsClientNewListByLocationPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachineScaleSets_GetInstanceView - fmt.Println("Call operation: VirtualMachineScaleSets_GetInstanceView") - _, err = virtualMachineScaleSetsClient.GetInstanceView(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, nil) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSets_GetOSUpgradeHistory - fmt.Println("Call operation: VirtualMachineScaleSets_GetOSUpgradeHistory") - virtualMachineScaleSetsClientNewGetOSUpgradeHistoryPager := virtualMachineScaleSetsClient.NewGetOSUpgradeHistoryPager(testsuite.resourceGroupName, testsuite.vmScaleSetName, nil) - for virtualMachineScaleSetsClientNewGetOSUpgradeHistoryPager.More() { - _, err := virtualMachineScaleSetsClientNewGetOSUpgradeHistoryPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachineScaleSets_ListAll - fmt.Println("Call operation: VirtualMachineScaleSets_ListAll") - virtualMachineScaleSetsClientNewListAllPager := virtualMachineScaleSetsClient.NewListAllPager(nil) - for virtualMachineScaleSetsClientNewListAllPager.More() { - _, err := virtualMachineScaleSetsClientNewListAllPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachineScaleSets_Get - fmt.Println("Call operation: VirtualMachineScaleSets_Get") - _, err = virtualMachineScaleSetsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil}) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSets_List - fmt.Println("Call operation: VirtualMachineScaleSets_List") - virtualMachineScaleSetsClientNewListPager := virtualMachineScaleSetsClient.NewListPager(testsuite.resourceGroupName, nil) - for virtualMachineScaleSetsClientNewListPager.More() { - _, err := virtualMachineScaleSetsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachineScaleSets_ListSkus - fmt.Println("Call operation: VirtualMachineScaleSets_ListSKUs") - virtualMachineScaleSetsClientNewListSKUsPager := virtualMachineScaleSetsClient.NewListSKUsPager(testsuite.resourceGroupName, testsuite.vmScaleSetName, nil) - for virtualMachineScaleSetsClientNewListSKUsPager.More() { - _, err := virtualMachineScaleSetsClientNewListSKUsPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachineScaleSets_Update - fmt.Println("Call operation: VirtualMachineScaleSets_Update") - virtualMachineScaleSetsClientUpdateResponsePoller, err := virtualMachineScaleSetsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, armcompute.VirtualMachineScaleSetUpdate{}, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSets_Redeploy - fmt.Println("Call operation: VirtualMachineScaleSets_Redeploy") - virtualMachineScaleSetsClientRedeployResponsePoller, err := virtualMachineScaleSetsClient.BeginRedeploy(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, &armcompute.VirtualMachineScaleSetsClientBeginRedeployOptions{VMInstanceIDs: nil}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientRedeployResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSets_Deallocate - fmt.Println("Call operation: VirtualMachineScaleSets_Deallocate") - virtualMachineScaleSetsClientDeallocateResponsePoller, err := virtualMachineScaleSetsClient.BeginDeallocate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, &armcompute.VirtualMachineScaleSetsClientBeginDeallocateOptions{VMInstanceIDs: nil}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientDeallocateResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSets_Start - fmt.Println("Call operation: VirtualMachineScaleSets_Start") - virtualMachineScaleSetsClientStartResponsePoller, err := virtualMachineScaleSetsClient.BeginStart(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, &armcompute.VirtualMachineScaleSetsClientBeginStartOptions{VMInstanceIDs: nil}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientStartResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSets_Reimage - fmt.Println("Call operation: VirtualMachineScaleSets_Reimage") - virtualMachineScaleSetsClientReimageResponsePoller, err := virtualMachineScaleSetsClient.BeginReimage(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, &armcompute.VirtualMachineScaleSetsClientBeginReimageOptions{VMScaleSetReimageInput: nil}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientReimageResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSets_Restart - fmt.Println("Call operation: VirtualMachineScaleSets_Restart") - virtualMachineScaleSetsClientRestartResponsePoller, err := virtualMachineScaleSetsClient.BeginRestart(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, &armcompute.VirtualMachineScaleSetsClientBeginRestartOptions{VMInstanceIDs: nil}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientRestartResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSets_ReimageAll - fmt.Println("Call operation: VirtualMachineScaleSets_ReimageAll") - virtualMachineScaleSetsClientReimageAllResponsePoller, err := virtualMachineScaleSetsClient.BeginReimageAll(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, &armcompute.VirtualMachineScaleSetsClientBeginReimageAllOptions{VMInstanceIDs: nil}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientReimageAllResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId} -func (testsuite *VirtualMachineScaleSetTestSuite) TestVirtualMachineScaleSetVMs() { - instanceId := "0" - var err error - // From step VirtualMachineScaleSetVMs_List - fmt.Println("Call operation: VirtualMachineScaleSetVMs_List") - virtualMachineScaleSetVMsClient, err := armcompute.NewVirtualMachineScaleSetVMsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachineScaleSetVMsClientNewListPager := virtualMachineScaleSetVMsClient.NewListPager(testsuite.resourceGroupName, testsuite.vmScaleSetName, &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: nil, - Select: nil, - Expand: nil, - }) - for virtualMachineScaleSetVMsClientNewListPager.More() { - _, err := virtualMachineScaleSetVMsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step VirtualMachineScaleSetVMs_Get - fmt.Println("Call operation: VirtualMachineScaleSetVMs_Get") - _, err = virtualMachineScaleSetVMsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, instanceId, &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil}) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMs_GetInstanceView - fmt.Println("Call operation: VirtualMachineScaleSetVMs_GetInstanceView") - _, err = virtualMachineScaleSetVMsClient.GetInstanceView(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, instanceId, nil) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMs_Redeploy - fmt.Println("Call operation: VirtualMachineScaleSetVMs_Redeploy") - virtualMachineScaleSetVMsClientRedeployResponsePoller, err := virtualMachineScaleSetVMsClient.BeginRedeploy(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, instanceId, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMsClientRedeployResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMs_Start - fmt.Println("Call operation: VirtualMachineScaleSetVMs_Start") - virtualMachineScaleSetVMsClientStartResponsePoller, err := virtualMachineScaleSetVMsClient.BeginStart(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, instanceId, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMsClientStartResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMs_Restart - fmt.Println("Call operation: VirtualMachineScaleSetVMs_Restart") - virtualMachineScaleSetVMsClientRestartResponsePoller, err := virtualMachineScaleSetVMsClient.BeginRestart(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, instanceId, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMsClientRestartResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMs_Deallocate - fmt.Println("Call operation: VirtualMachineScaleSetVMs_Deallocate") - virtualMachineScaleSetVMsClientDeallocateResponsePoller, err := virtualMachineScaleSetVMsClient.BeginDeallocate(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, instanceId, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMsClientDeallocateResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMs_Reimage - fmt.Println("Call operation: VirtualMachineScaleSetVMs_Reimage") - virtualMachineScaleSetVMsClientReimageResponsePoller, err := virtualMachineScaleSetVMsClient.BeginReimage(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, instanceId, &armcompute.VirtualMachineScaleSetVMsClientBeginReimageOptions{VMScaleSetVMReimageInput: nil}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMsClientReimageResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMs_PowerOff - fmt.Println("Call operation: VirtualMachineScaleSetVMs_PowerOff") - virtualMachineScaleSetVMsClientPowerOffResponsePoller, err := virtualMachineScaleSetVMsClient.BeginPowerOff(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, instanceId, &armcompute.VirtualMachineScaleSetVMsClientBeginPowerOffOptions{SkipShutdown: nil}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMsClientPowerOffResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSetVMs_Delete - fmt.Println("Call operation: VirtualMachineScaleSetVMs_Delete") - virtualMachineScaleSetVMsClientDeleteResponsePoller, err := virtualMachineScaleSetVMsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, instanceId, &armcompute.VirtualMachineScaleSetVMsClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetVMsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} - -func (testsuite *VirtualMachineScaleSetTestSuite) Cleanup() { - var err error - // From step VirtualMachineScaleSets_PowerOff - fmt.Println("Call operation: VirtualMachineScaleSets_PowerOff") - virtualMachineScaleSetsClient, err := armcompute.NewVirtualMachineScaleSetsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - virtualMachineScaleSetsClientPowerOffResponsePoller, err := virtualMachineScaleSetsClient.BeginPowerOff(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, &armcompute.VirtualMachineScaleSetsClientBeginPowerOffOptions{SkipShutdown: nil, - VMInstanceIDs: nil, - }) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientPowerOffResponsePoller) - testsuite.Require().NoError(err) - - // From step VirtualMachineScaleSets_Delete - fmt.Println("Call operation: VirtualMachineScaleSets_Delete") - virtualMachineScaleSetsClientDeleteResponsePoller, err := virtualMachineScaleSetsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.vmScaleSetName, &armcompute.VirtualMachineScaleSetsClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)}) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, virtualMachineScaleSetsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} 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 e1743c84c113..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go +++ /dev/null @@ -1,374 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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]any{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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]any{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetExtensionsClientGetOptions{Expand: to.Ptr("aaaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().Get(ctx, "rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetExtensionsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetExtensionListResult = armcompute.VirtualMachineScaleSetExtensionListResult{ - // Value: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetExtensionsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetExtensionListResult = armcompute.VirtualMachineScaleSetExtensionListResult{ - // Value: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // }}, - // } - } -} 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 2140b662357c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().GetLatest(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RollingUpgradeStatusInfo = armcompute.RollingUpgradeStatusInfo{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaa"), - // Location: to.Ptr("aaaaaa"), - // Tags: map[string]*string{ - // "key8533": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.RollingUpgradeStatusInfoProperties{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaaaaaaaa"), - // Target: to.Ptr("aaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aa"), - // Target: to.Ptr("aaaa"), - // }}, - // }, - // Policy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // RollbackFailedInstancesOnPolicyBreach: to.Ptr(true), - // }, - // Progress: &armcompute.RollingUpgradeProgressInfo{ - // FailedInstanceCount: to.Ptr[int32](25), - // InProgressInstanceCount: to.Ptr[int32](20), - // PendingInstanceCount: to.Ptr[int32](27), - // SuccessfulInstanceCount: to.Ptr[int32](6), - // }, - // RunningStatus: &armcompute.RollingUpgradeRunningStatus{ - // Code: to.Ptr(armcompute.RollingUpgradeStatusCodeRollingForward), - // LastAction: to.Ptr(armcompute.RollingUpgradeActionTypeStart), - // LastActionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:06:23.362Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:06:23.362Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().GetLatest(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RollingUpgradeStatusInfo = armcompute.RollingUpgradeStatusInfo{ - // Location: to.Ptr("aaaaaa"), - // } -} 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 2eff5982d4e4..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go +++ /dev/null @@ -1,9571 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListByLocationPager("eastus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListResult = armcompute.VirtualMachineScaleSetListResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue2"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic1"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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]any{}, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.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]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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]any{}, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.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]any{ - // }, - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d6e9ab29-f8c9-4792-978c-ae2c07b98f17"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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("https://{existing-storage-account-name}.blob.core.windows.net/system/Microsoft.Compute/Images/vhds/{existing-generalized-os-image-blob-name}.vhd"), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("77b7df9a-32fe-45e3-8911-60ac9c9b9c64"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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}.blob.core.windows.net/vhds")}, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{nicConfig1-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("{nicConfig2-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DisableTCPStateTracking: to.Ptr(false), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableFpga: 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("ffb27c5c-39a5-4d4e-b307-b32598689813"), - // 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"), - // 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"), - // }, - // { - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // 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/nsgcustom"), - // }, - // 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_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("{fpgaNic-Name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableFpga: to.Ptr(true), - // 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{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithOsImageScheduledEventsEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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{ - OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT15M"), - }, - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithServiceArtifactReference() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("eastus2euap"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - EnableAutomaticOSUpgrade: to.Ptr(true), - }, - 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}"), - }, - ServiceArtifactReference: &armcompute.ServiceArtifactReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/serviceArtifacts/serviceArtifactName/vmArtifactsProfiles/vmArtifactsProfilesName"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2022-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Name: to.Ptr("osDisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_A1"), - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("77b7df9a-32fe-45e3-8911-60ac9c9b9c64"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ServiceArtifactReference: &armcompute.ServiceArtifactReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/serviceArtifacts/serviceArtifactName/vmArtifactsProfiles/vmArtifactsProfilesName"), - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2022-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("osDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_A1"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("a0134477-b9d9-484b-b0e3-205c1c089ffa"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // 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/nsgExistingAppGw/backendAddressPools/appGatewayBackendPool"), - // }}, - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("ec0b21ca-51ec-414b-9323-f236ffc21479"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // 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/myLb/backendAddressPools/lbBackendPool"), - // }}, - // LoadBalancerInboundNatPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/myLb/inboundNatPools/lbNatPool"), - // }}, - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("PT10M"), - // }, - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("8042c376-4690-4c47-9fa2-fbdad70e32fa"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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]any{}, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.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]any{ - // }, - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("ffb27c5c-39a5-4d4e-b307-b32598689813"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("19fd38a2-f50a-42c6-9dc7-3f9cf3791225"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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_DS1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // 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), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesOldestVM)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("PT1H"), - // }, - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("fb73af19-0090-467c-9ced-b00bceab1c45"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // 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"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("UbuntuServer"), - // Publisher: to.Ptr("Canonical"), - // SKU: to.Ptr("16.04-LTS"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("centralus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UniqueID: to.Ptr("8042c376-4690-4c47-9fa2-fbdad70e32fa"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // 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), - // }, - // }, - // }, - // }, - // ZoneBalance: to.Ptr(false), - // }, - // 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")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // 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{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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), - MaxSurge: to.Ptr(true), - MaxUnhealthyInstancePercent: to.Ptr[int32](81), - MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - PrioritizeUnhealthyInstances: to.Ptr(true), - RollbackFailedInstancesOnPolicyBreach: 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]any{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key8425": to.Ptr("aaa"), - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // 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), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // 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), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaaaaa"), - // 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), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](-1), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("http://{existing-storage-account-name}.blob.core.windows.net"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("PT1H20M"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // 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.VirtualMachineScaleSetPublicIPAddressConfiguration{ - // Name: to.Ptr("a"), - // Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - // DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](3), - // 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.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.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // 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), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // 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.VirtualMachineScaleSetStorageProfile{ - // 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"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaa"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // 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), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaaaaaaaaaaaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // 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("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // DiskControllerType: to.Ptr("NVMe"), - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // 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("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // 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"), - // }, - // { - // 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("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().GetInstanceView(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetInstanceView = armcompute.VirtualMachineScaleSetInstanceView{ - // OrchestrationServices: []*armcompute.OrchestrationServiceSummary{ - // { - // ServiceName: to.Ptr(armcompute.OrchestrationServiceNamesAutomaticRepairs), - // ServiceState: to.Ptr(armcompute.OrchestrationServiceStateNotRunning), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()), - // }}, - // VirtualMachine: &armcompute.VirtualMachineScaleSetInstanceViewStatusesSummary{ - // StatusesSummary: []*armcompute.VirtualMachineStatusCodeCount{ - // { - // Code: to.Ptr("aa"), - // Count: to.Ptr[int32](21), - // }}, - // }, - // Extensions: []*armcompute.VirtualMachineScaleSetVMExtensionsSummary{ - // { - // Name: to.Ptr("aaaaaaaaaaa"), - // StatusesSummary: []*armcompute.VirtualMachineStatusCodeCount{ - // { - // Code: to.Ptr("aa"), - // Count: to.Ptr[int32](21), - // }}, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().GetInstanceView(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetInstanceView = armcompute.VirtualMachineScaleSetInstanceView{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListResult = armcompute.VirtualMachineScaleSetListResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesDefault)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // DisableAutomaticRollback: to.Ptr(true), - // EnableAutomaticOSUpgrade: to.Ptr(true), - // UseRollingUpgradePolicy: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // RollbackFailedInstancesOnPolicyBreach: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](4), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aa"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aaaaaaaaaaaaaa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // ID: to.Ptr("aa"), - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaa"), - // Name: to.Ptr("myIPConfig"), - // 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/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // 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"), - // }}, - // }, - // }, - // 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), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("aa"), - // }, - // }, - // 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.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaa"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](30), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaa")}, - // }, - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesDefault)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // DisableAutomaticRollback: to.Ptr(true), - // EnableAutomaticOSUpgrade: to.Ptr(true), - // UseRollingUpgradePolicy: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](4), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aa"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aaaaaaaaaaaaaa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("myNic1"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("myIPConfig"), - // 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/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // CustomData: to.Ptr("a"), - // 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"), - // }}, - // }, - // }, - // 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), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("aa"), - // }, - // }, - // 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.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaa"), - // ExactVersion: to.Ptr("aa"), - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SharedGalleryImageID: to.Ptr("aaaaaaa"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("a"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](30), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListResult = armcompute.VirtualMachineScaleSetListResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Location: to.Ptr("eastus"), - // }, - // { - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListWithLinkResult = armcompute.VirtualMachineScaleSetListWithLinkResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key8425": to.Ptr("aaa"), - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesDefault)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaaaaa"), - // 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), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // RollbackFailedInstancesOnPolicyBreach: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](4), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &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("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aa"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aaaaaaaaaaaaaa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaa"), - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaa"), - // Name: to.Ptr("{vmss-name}"), - // 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/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // 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("aaa"), - // KeyData: to.Ptr("aaaaaa"), - // }}, - // }, - // }, - // 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), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("aa"), - // }, - // }, - // 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.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskIOPSReadWrite: to.Ptr[int64](11), - // DiskMBpsReadWrite: to.Ptr[int64](13), - // DiskSizeGB: to.Ptr[int32](11), - // Lun: to.Ptr[int32](24), - // 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("a"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](30), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListWithLinkResult = armcompute.VirtualMachineScaleSetListWithLinkResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListSKUsPager("rgcompute", "aaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListSKUsResult = armcompute.VirtualMachineScaleSetListSKUsResult{ - // Value: []*armcompute.VirtualMachineScaleSetSKU{ - // { - // Capacity: &armcompute.VirtualMachineScaleSetSKUCapacity{ - // DefaultCapacity: to.Ptr[int64](20), - // Maximum: to.Ptr[int64](27), - // Minimum: to.Ptr[int64](22), - // ScaleType: to.Ptr(armcompute.VirtualMachineScaleSetSKUScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("aaaaaaaaaaaaaaaaa"), - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // Capacity: to.Ptr[int64](7), - // Tier: to.Ptr("aaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListSKUsPager("rgcompute", "aaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListSKUsResult = armcompute.VirtualMachineScaleSetListSKUsResult{ - // Value: []*armcompute.VirtualMachineScaleSetSKU{ - // { - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewGetOSUpgradeHistoryPager("rgcompute", "aaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListOSUpgradeHistory = armcompute.VirtualMachineScaleSetListOSUpgradeHistory{ - // Value: []*armcompute.UpgradeOperationHistoricalStatusInfo{ - // { - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Properties: &armcompute.UpgradeOperationHistoricalStatusInfoProperties{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaaaaaaaa"), - // Target: to.Ptr("aaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aa"), - // Target: to.Ptr("aaaa"), - // }}, - // }, - // Progress: &armcompute.RollingUpgradeProgressInfo{ - // FailedInstanceCount: to.Ptr[int32](25), - // InProgressInstanceCount: to.Ptr[int32](20), - // PendingInstanceCount: to.Ptr[int32](27), - // SuccessfulInstanceCount: to.Ptr[int32](6), - // }, - // RollbackInfo: &armcompute.RollbackStatusInfo{ - // FailedRolledbackInstanceCount: to.Ptr[int32](2), - // RollbackError: &armcompute.APIError{ - // Code: to.Ptr("aaaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaaaaaaaa"), - // Target: to.Ptr("aaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aa"), - // Target: to.Ptr("aaaa"), - // }}, - // }, - // SuccessfullyRolledbackInstanceCount: to.Ptr[int32](12), - // }, - // RunningStatus: &armcompute.UpgradeOperationHistoryStatus{ - // Code: to.Ptr(armcompute.UpgradeStateRollingForward), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:05:40.443Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:05:40.442Z"); return t}()), - // }, - // StartedBy: to.Ptr(armcompute.UpgradeOperationInvokerUnknown), - // TargetImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ExactVersion: to.Ptr("aaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaa"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewGetOSUpgradeHistoryPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListOSUpgradeHistory = armcompute.VirtualMachineScaleSetListOSUpgradeHistory{ - // Value: []*armcompute.UpgradeOperationHistoricalStatusInfo{ - // { - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", 30, &armcompute.VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions{Zone: nil, - PlacementGroupID: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecoveryWalkResponse = armcompute.RecoveryWalkResponse{ - // NextPlatformUpdateDomain: to.Ptr[int32](7), - // WalkPerformed: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, "rgcompute", "aaaaaaaaaaaa", 9, &armcompute.VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions{Zone: nil, - PlacementGroupID: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecoveryWalkResponse = armcompute.RecoveryWalkResponse{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().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 b4d639467411..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go +++ /dev/null @@ -1,226 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", armcompute.VirtualMachineScaleSetVMExtension{ - Properties: &armcompute.VirtualMachineExtensionProperties{ - Type: to.Ptr("extType"), - AutoUpgradeMinorVersion: to.Ptr(true), - Publisher: to.Ptr("extPublisher"), - Settings: map[string]any{ - "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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtension = armcompute.VirtualMachineScaleSetVMExtension{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().BeginUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", armcompute.VirtualMachineScaleSetVMExtensionUpdate{ - Properties: &armcompute.VirtualMachineExtensionUpdateProperties{ - Type: to.Ptr("extType"), - AutoUpgradeMinorVersion: to.Ptr(true), - Publisher: to.Ptr("extPublisher"), - Settings: map[string]any{ - "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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtension = armcompute.VirtualMachineScaleSetVMExtension{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, 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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", &armcompute.VirtualMachineScaleSetVMExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtension = armcompute.VirtualMachineScaleSetVMExtension{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().List(ctx, "myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMExtensionsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtensionsListResult = armcompute.VirtualMachineScaleSetVMExtensionsListResult{ - // Value: []*armcompute.VirtualMachineScaleSetVMExtension{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension1"), - // Name: to.Ptr("myVMExtension1"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType1"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher1"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.0"), - // }, - // }}, - // } -} 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 05d60c523af0..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go +++ /dev/null @@ -1,266 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // 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"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // 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"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Script Source Updated!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", &armcompute.VirtualMachineScaleSetVMRunCommandsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // 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"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().NewListPager("myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMRunCommandsClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineRunCommandsListResult = armcompute.VirtualMachineRunCommandsListResult{ - // Value: []*armcompute.VirtualMachineRunCommand{ - // { - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // 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"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](0), - // }, - // }}, - // } - } -} 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 69edd8ece354..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go +++ /dev/null @@ -1,2362 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // InstanceID: to.Ptr("aaaaaaaaaaaa"), - // 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{ - // AssignedHost: to.Ptr("aaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaa"), - // 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"), - // }}, - // }, - // LatestModelApplied: to.Ptr(true), - // LicenseType: to.Ptr("aaaaaaaaaa"), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // 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{ - // 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), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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), - // DiskIOPSReadWrite: to.Ptr[int64](18), - // DiskMBpsReadWrite: to.Ptr[int64](29), - // 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"), - // ExactVersion: to.Ptr("4.127.20180315"), - // 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=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaa"), - // 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]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // Zones: []*string{ - // to.Ptr("a")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().Get(ctx, "myResourceGroup", "{vmss-name}", "0", &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetVMProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // }, - // LatestModelApplied: to.Ptr(true), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"), - // }}, - // }, - // NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig5415"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig9693"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("test000000"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](128), - // 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"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(false), - // }}, - // ImageReference: &armcompute.ImageReference{ - // ExactVersion: to.Ptr("4.127.20180315"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // 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), - // DiskSizeGB: to.Ptr[int32](127), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().Get(ctx, "myResourceGroup", "{vmss-name}", "0", &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetVMProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](1), - // VCPUsPerCore: to.Ptr[int32](1), - // }, - // }, - // LatestModelApplied: to.Ptr(true), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"), - // }}, - // }, - // NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig5415"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig9693"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("test000000"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](128), - // 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"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(false), - // }}, - // ImageReference: &armcompute.ImageReference{ - // ExactVersion: to.Ptr("4.127.20180315"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // 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), - // DiskSizeGB: to.Ptr[int32](127), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().GetInstanceView(ctx, "myResourceGroup", "myVirtualMachineScaleSet", "0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMInstanceView = armcompute.VirtualMachineScaleSetVMInstanceView{ - // AssignedHost: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup/hosts/myHost"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("myOSDisk"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T04:58:58.0882815+00:00"); return t}()), - // }}, - // }}, - // PlatformFaultDomain: to.Ptr[int32](0), - // PlatformUpdateDomain: to.Ptr[int32](0), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-05T04:59:58.1852966+00:00"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/running"), - // DisplayStatus: to.Ptr("VM running"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/Unavailable"), - // DisplayStatus: to.Ptr("Not Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesWarning), - // Message: to.Ptr("VM status blob is found but not yet populated."), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T05:00:32+00:00"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("Unknown"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetVMsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: to.Ptr("aaaaaaaaaaaaaa"), - Select: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - Expand: to.Ptr("aaaaaaaaaaaaa"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetVMListResult = armcompute.VirtualMachineScaleSetVMListResult{ - // Value: []*armcompute.VirtualMachineScaleSetVM{ - // { - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // InstanceID: to.Ptr("aaaaaaaaaaaa"), - // 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{ - // AssignedHost: to.Ptr("aaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaa"), - // 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"), - // }}, - // }, - // LatestModelApplied: to.Ptr(true), - // LicenseType: to.Ptr("aaaaaaaaaa"), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // 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{ - // 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), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // 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), - // DiskIOPSReadWrite: to.Ptr[int64](18), - // DiskMBpsReadWrite: to.Ptr[int64](29), - // 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"), - // ExactVersion: to.Ptr("4.127.20180315"), - // 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=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaa"), - // 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]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // Zones: []*string{ - // to.Ptr("a")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetVMsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: nil, - Select: nil, - Expand: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetVMListResult = armcompute.VirtualMachineScaleSetVMListResult{ - // Value: []*armcompute.VirtualMachineScaleSetVM{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().RetrieveBootDiagnosticsData(ctx, "ResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions{SasURIExpirationTimeInMinutes: to.Ptr[int32](60)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RetrieveBootDiagnosticsDataResult = armcompute.RetrieveBootDiagnosticsDataResult{ - // ConsoleScreenshotBlobURI: to.Ptr("https://storageuri/myvmScaleSetinstance.screenshot.bmp?{saskey}"), - // SerialConsoleLogBlobURI: to.Ptr("https://storageuri/myvmScaleSetinstance.serialconsole.log?{saskey}"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachineScaleSetVMsClient().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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RunCommandResult = armcompute.RunCommandResult{ - // Value: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ComponentStatus/StdOut/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("Hello World!"), - // }, - // { - // Code: to.Ptr("ComponentStatus/StdErr/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr(""), - // }}, - // } -} 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 9b8413f6630d..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client_example_test.go +++ /dev/null @@ -1,89 +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. -// DO NOT EDIT. - -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/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineSizesClient().NewListPager("-e", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // Value: []*armcompute.VirtualMachineSize{ - // { - // Name: to.Ptr("Standard_A1_V2"), - // MaxDataDiskCount: to.Ptr[int32](2), - // MemoryInMB: to.Ptr[int32](2048), - // NumberOfCores: to.Ptr[int32](1), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](10240), - // }, - // { - // Name: to.Ptr("Standard_A2_V2"), - // MaxDataDiskCount: to.Ptr[int32](4), - // MemoryInMB: to.Ptr[int32](4096), - // NumberOfCores: to.Ptr[int32](2), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](20480), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-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() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineSizesClient().NewListPager("._..", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // } - } -}