From ffa9ae2aa6a1ff132c2a23dc690cd626952b11e9 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 24 Oct 2023 21:52:56 +0000 Subject: [PATCH] CodeGen from PR 25543 in Azure/azure-rest-api-specs Merge 933c21d59c33283e4a075aed971ad86bb80b7050 into ceffc2870986ab280d7ee7e056297ca5b449abed --- .../compute/armcompute/CHANGELOG.md | 8 + .../compute/armcompute/autorest.md | 7 +- .../armcompute/availabilitysets_client.go | 28 +- .../availabilitysets_client_example_test.go | 634 -- .../capacityreservationgroups_client.go | 24 +- ...tyreservationgroups_client_example_test.go | 403 - .../armcompute/capacityreservations_client.go | 26 +- ...apacityreservations_client_example_test.go | 387 - ...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 - .../communitygalleries_client_example_test.go | 46 - ...munitygalleryimages_client_example_test.go | 103 - ...alleryimageversions_client_example_test.go | 103 - .../compute/armcompute/constants.go | 2 +- .../armcompute/dedicatedhostgroups_client.go | 24 +- ...dedicatedhostgroups_client_example_test.go | 620 - .../armcompute/dedicatedhosts_client.go | 36 +- .../dedicatedhosts_client_example_test.go | 510 - .../diskaccesses_client_example_test.go | 529 - .../diskencryptionsets_client_example_test.go | 660 -- .../diskrestorepoint_client_example_test.go | 184 - .../armcompute/disks_client_example_test.go | 2186 ---- .../fake/availabilitysets_server.go | 2 +- .../fake/capacityreservationgroups_server.go | 2 +- .../fake/capacityreservations_server.go | 2 +- .../cloudserviceoperatingsystems_server.go | 2 +- .../fake/cloudserviceroleinstances_server.go | 2 +- .../fake/cloudserviceroles_server.go | 2 +- .../armcompute/fake/cloudservices_server.go | 2 +- .../fake/cloudservicesupdatedomain_server.go | 2 +- .../fake/communitygalleries_server.go | 2 +- .../fake/communitygalleryimages_server.go | 2 +- .../communitygalleryimageversions_server.go | 2 +- .../fake/dedicatedhostgroups_server.go | 2 +- .../armcompute/fake/dedicatedhosts_server.go | 2 +- .../armcompute/fake/diskaccesses_server.go | 2 +- .../fake/diskencryptionsets_server.go | 2 +- .../fake/diskrestorepoint_server.go | 2 +- .../compute/armcompute/fake/disks_server.go | 2 +- .../armcompute/fake/galleries_server.go | 2 +- .../fake/galleryapplications_server.go | 2 +- .../fake/galleryapplicationversions_server.go | 2 +- .../armcompute/fake/galleryimages_server.go | 2 +- .../fake/galleryimageversions_server.go | 2 +- .../fake/gallerysharingprofile_server.go | 2 +- .../compute/armcompute/fake/images_server.go | 2 +- .../armcompute/fake/loganalytics_server.go | 2 +- .../armcompute/fake/operations_server.go | 2 +- .../fake/proximityplacementgroups_server.go | 2 +- .../armcompute/fake/resourceskus_server.go | 2 +- .../fake/restorepointcollections_server.go | 2 +- .../armcompute/fake/restorepoints_server.go | 2 +- .../armcompute/fake/sharedgalleries_server.go | 2 +- .../fake/sharedgalleryimages_server.go | 2 +- .../fake/sharedgalleryimageversions_server.go | 2 +- .../armcompute/fake/snapshots_server.go | 2 +- .../armcompute/fake/sshpublickeys_server.go | 2 +- .../compute/armcompute/fake/usage_server.go | 2 +- .../virtualmachineextensionimages_server.go | 2 +- .../fake/virtualmachineextensions_server.go | 2 +- .../fake/virtualmachineimages_server.go | 2 +- .../virtualmachineimagesedgezone_server.go | 2 +- .../fake/virtualmachineruncommands_server.go | 2 +- .../armcompute/fake/virtualmachines_server.go | 2 +- ...virtualmachinescalesetextensions_server.go | 2 +- ...almachinescalesetrollingupgrades_server.go | 2 +- .../fake/virtualmachinescalesets_server.go | 64 +- ...rtualmachinescalesetvmextensions_server.go | 2 +- ...tualmachinescalesetvmruncommands_server.go | 2 +- .../fake/virtualmachinescalesetvms_server.go | 110 +- .../fake/virtualmachinesizes_server.go | 2 +- .../galleries_client_example_test.go | 521 - ...galleryapplications_client_example_test.go | 285 - ...applicationversions_client_example_test.go | 473 - .../galleryimages_client_example_test.go | 219 - ...alleryimageversions_client_example_test.go | 1852 --- ...llerysharingprofile_client_example_test.go | 130 - sdk/resourcemanager/compute/armcompute/go.mod | 3 +- sdk/resourcemanager/compute/armcompute/go.sum | 3 + .../compute/armcompute/images_client.go | 30 +- .../armcompute/images_client_example_test.go | 946 -- .../compute/armcompute/loganalytics_client.go | 12 +- .../loganalytics_client_example_test.go | 93 - .../compute/armcompute/models.go | 5 + .../compute/armcompute/models_serde.go | 4 + .../compute/armcompute/operations_client.go | 4 +- .../operations_client_example_test.go | 83 - .../compute/armcompute/options.go | 17 + .../proximityplacementgroups_client.go | 24 +- ...mityplacementgroups_client_example_test.go | 277 - .../resourceskus_client_example_test.go | 612 - .../compute/armcompute/response_types.go | 10 + .../restorepointcollections_client.go | 26 +- ...orepointcollections_client_example_test.go | 634 -- .../armcompute/restorepoints_client.go | 16 +- .../restorepoints_client_example_test.go | 315 - .../sharedgalleries_client_example_test.go | 80 - ...sharedgalleryimages_client_example_test.go | 102 - ...alleryimageversions_client_example_test.go | 102 - .../snapshots_client_example_test.go | 746 -- .../armcompute/sshpublickeys_client.go | 28 +- .../sshpublickeys_client_example_test.go | 351 - .../compute/armcompute/usage_client.go | 4 +- .../armcompute/usage_client_example_test.go | 90 - .../virtualmachineextensionimages_client.go | 12 +- ...hineextensionimages_client_example_test.go | 212 - .../virtualmachineextensions_client.go | 26 +- ...almachineextensions_client_example_test.go | 439 - .../armcompute/virtualmachineimages_client.go | 24 +- ...irtualmachineimages_client_example_test.go | 408 - .../virtualmachineimagesedgezone_client.go | 20 +- ...chineimagesedgezone_client_example_test.go | 344 - .../virtualmachineruncommands_client.go | 34 +- ...lmachineruncommands_client_example_test.go | 452 - .../armcompute/virtualmachines_client.go | 132 +- .../virtualmachines_client_example_test.go | 9049 --------------- ...virtualmachinescalesetextensions_client.go | 26 +- ...escalesetextensions_client_example_test.go | 374 - ...almachinescalesetrollingupgrades_client.go | 22 +- ...esetrollingupgrades_client_example_test.go | 215 - .../virtualmachinescalesets_client.go | 206 +- ...ualmachinescalesets_client_example_test.go | 9982 ----------------- ...rtualmachinescalesetvmextensions_client.go | 26 +- ...calesetvmextensions_client_example_test.go | 226 - ...tualmachinescalesetvmruncommands_client.go | 26 +- ...alesetvmruncommands_client_example_test.go | 291 - .../virtualmachinescalesetvms_client.go | 163 +- ...lmachinescalesetvms_client_example_test.go | 2359 ---- .../armcompute/virtualmachinesizes_client.go | 4 +- ...virtualmachinesizes_client_example_test.go | 89 - 133 files changed, 826 insertions(+), 41165 deletions(-) delete mode 100644 sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_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/dedicatedhostgroups_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_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/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/proximityplacementgroups_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/resourceskus_client_example_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/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/snapshots_client_example_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/virtualmachineextensionimages_client_example_test.go delete mode 100644 sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_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/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 9d8a15b94fc2..9b7ca540aac1 100644 --- a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md +++ b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## 5.3.0 (2023-10-24) +### Features Added + +- New function `*VirtualMachineScaleSetVMsClient.BeginApproveRollingUpgrade(context.Context, string, string, string, *VirtualMachineScaleSetVMsClientBeginApproveRollingUpgradeOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientApproveRollingUpgradeResponse], error)` +- New function `*VirtualMachineScaleSetsClient.BeginApproveRollingUpgrade(context.Context, string, string, *VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions) (*runtime.Poller[VirtualMachineScaleSetsClientApproveRollingUpgradeResponse], error)` +- New field `OSRollingUpgradeDeferral` in struct `AutomaticOSUpgradePolicy` + + ## 5.3.0-beta.1 (2023-10-09) ### Features Added diff --git a/sdk/resourcemanager/compute/armcompute/autorest.md b/sdk/resourcemanager/compute/armcompute/autorest.md index dc828b66c05c..4519ae7b66ae 100644 --- a/sdk/resourcemanager/compute/armcompute/autorest.md +++ b/sdk/resourcemanager/compute/armcompute/autorest.md @@ -5,11 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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: 5.3.0-beta.1 -tag: package-2023-07-01 +module-version: 5.3.0 azcore-version: 1.9.0-beta.1 generate-fakes: true inject-spans: true diff --git a/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go b/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go index fc09ff426ec0..3fba19907552 100644 --- a/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go +++ b/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go @@ -47,7 +47,7 @@ func NewAvailabilitySetsClient(subscriptionID string, credential azcore.TokenCre // CreateOrUpdate - Create or update an availability set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - availabilitySetName - The name of the availability set. // - parameters - Parameters supplied to the Create Availability Set operation. @@ -95,7 +95,7 @@ func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -116,7 +116,7 @@ func (client *AvailabilitySetsClient) createOrUpdateHandleResponse(resp *http.Re // Delete - Delete an availability set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - availabilitySetName - The name of the availability set. // - options - AvailabilitySetsClientDeleteOptions contains the optional parameters for the AvailabilitySetsClient.Delete method. @@ -161,7 +161,7 @@ func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -170,7 +170,7 @@ func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, r // Get - Retrieves information about an availability set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - availabilitySetName - The name of the availability set. // - options - AvailabilitySetsClientGetOptions contains the optional parameters for the AvailabilitySetsClient.Get method. @@ -216,7 +216,7 @@ func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,7 +233,7 @@ func (client *AvailabilitySetsClient) getHandleResponse(resp *http.Response) (Av // NewListPager - Lists all availability sets in a resource group. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - options - AvailabilitySetsClientListOptions contains the optional parameters for the AvailabilitySetsClient.NewListPager // method. @@ -283,7 +283,7 @@ func (client *AvailabilitySetsClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -301,7 +301,7 @@ func (client *AvailabilitySetsClient) listHandleResponse(resp *http.Response) (A // NewListAvailableSizesPager - Lists all available virtual machine sizes that can be used to create a new virtual machine // in an existing availability set. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - availabilitySetName - The name of the availability set. // - options - AvailabilitySetsClientListAvailableSizesOptions contains the optional parameters for the AvailabilitySetsClient.NewListAvailableSizesPager @@ -350,7 +350,7 @@ func (client *AvailabilitySetsClient) listAvailableSizesCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -367,7 +367,7 @@ func (client *AvailabilitySetsClient) listAvailableSizesHandleResponse(resp *htt // NewListBySubscriptionPager - Lists all availability sets in a subscription. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - options - AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.NewListBySubscriptionPager // method. func (client *AvailabilitySetsClient) NewListBySubscriptionPager(options *AvailabilitySetsClientListBySubscriptionOptions) *runtime.Pager[AvailabilitySetsClientListBySubscriptionResponse] { @@ -412,7 +412,7 @@ func (client *AvailabilitySetsClient) listBySubscriptionCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -433,7 +433,7 @@ func (client *AvailabilitySetsClient) listBySubscriptionHandleResponse(resp *htt // Update - Update an availability set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - availabilitySetName - The name of the availability set. // - parameters - Parameters supplied to the Update Availability Set operation. @@ -480,7 +480,7 @@ func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 2a59341f4bc8..000000000000 --- a/sdk/resourcemanager/compute/armcompute/availabilitysets_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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Update_availabilitySetUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_Update_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Update_availabilitySetUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Delete_availabilitySetDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Delete_availabilitySetDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Get_availabilitySetGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Get_availabilitySetGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListPager_availabilitySetListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListPager_availabilitySetListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet1"), - // Location: to.Ptr("australiasoutheast"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet2"), - // Location: to.Ptr("australiasoutheast"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet3"), - // Location: to.Ptr("westcentralus"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet4"), - // Location: to.Ptr("westcentralus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListAvailableSizesPager_availabilitySetListAvailableSizesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListAvailableSizesPager_availabilitySetListAvailableSizesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/capacityreservationgroups_client.go b/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go index 9fe8b3aae7c8..4cccb776e469 100644 --- a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go @@ -49,7 +49,7 @@ func NewCapacityReservationGroupsClient(subscriptionID string, credential azcore // details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - parameters - Parameters supplied to the Create capacity reservation Group. @@ -97,7 +97,7 @@ func (client *CapacityReservationGroupsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -120,7 +120,7 @@ func (client *CapacityReservationGroupsClient) createOrUpdateHandleResponse(resp // the reservation group have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - options - CapacityReservationGroupsClientDeleteOptions contains the optional parameters for the CapacityReservationGroupsClient.Delete @@ -166,7 +166,7 @@ func (client *CapacityReservationGroupsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,7 +175,7 @@ func (client *CapacityReservationGroupsClient) deleteCreateRequest(ctx context.C // Get - The operation that retrieves information about a capacity reservation group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - options - CapacityReservationGroupsClientGetOptions contains the optional parameters for the CapacityReservationGroupsClient.Get @@ -225,7 +225,7 @@ func (client *CapacityReservationGroupsClient) getCreateRequest(ctx context.Cont if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,7 +243,7 @@ func (client *CapacityReservationGroupsClient) getHandleResponse(resp *http.Resp // NewListByResourceGroupPager - Lists all of the capacity reservation groups in the specified resource group. Use the nextLink // property in the response to get the next page of capacity reservation groups. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - options - CapacityReservationGroupsClientListByResourceGroupOptions contains the optional parameters for the CapacityReservationGroupsClient.NewListByResourceGroupPager // method. @@ -293,7 +293,7 @@ func (client *CapacityReservationGroupsClient) listByResourceGroupCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -314,7 +314,7 @@ func (client *CapacityReservationGroupsClient) listByResourceGroupHandleResponse // NewListBySubscriptionPager - Lists all of the capacity reservation groups in the subscription. Use the nextLink property // in the response to get the next page of capacity reservation groups. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - options - CapacityReservationGroupsClientListBySubscriptionOptions contains the optional parameters for the CapacityReservationGroupsClient.NewListBySubscriptionPager // method. func (client *CapacityReservationGroupsClient) NewListBySubscriptionPager(options *CapacityReservationGroupsClientListBySubscriptionOptions) *runtime.Pager[CapacityReservationGroupsClientListBySubscriptionResponse] { @@ -359,7 +359,7 @@ func (client *CapacityReservationGroupsClient) listBySubscriptionCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -381,7 +381,7 @@ func (client *CapacityReservationGroupsClient) listBySubscriptionHandleResponse( // be modified. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - parameters - Parameters supplied to the Update capacity reservation Group operation. @@ -429,7 +429,7 @@ func (client *CapacityReservationGroupsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 28369175f904..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Update_capacityReservationGroupUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MinimumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Update_capacityReservationGroupUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Delete_capacityReservationGroupDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Delete_capacityReservationGroupDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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.go b/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go index d28f6e537070..27e85f3e7931 100644 --- a/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go +++ b/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go @@ -49,7 +49,7 @@ func NewCapacityReservationsClient(subscriptionID string, credential azcore.Toke // details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - capacityReservationName - The name of the capacity reservation. @@ -74,7 +74,7 @@ func (client *CapacityReservationsClient) BeginCreateOrUpdate(ctx context.Contex // details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *CapacityReservationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CapacityReservationsClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *CapacityReservationsClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -134,7 +134,7 @@ func (client *CapacityReservationsClient) createOrUpdateCreateRequest(ctx contex // https://aka.ms/CapacityReservation for more details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - capacityReservationName - The name of the capacity reservation. @@ -158,7 +158,7 @@ func (client *CapacityReservationsClient) BeginDelete(ctx context.Context, resou // https://aka.ms/CapacityReservation for more details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *CapacityReservationsClient) deleteOperation(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CapacityReservationsClient.BeginDelete" @@ -204,7 +204,7 @@ func (client *CapacityReservationsClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +213,7 @@ func (client *CapacityReservationsClient) deleteCreateRequest(ctx context.Contex // Get - The operation that retrieves information about the capacity reservation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - capacityReservationName - The name of the capacity reservation. @@ -268,7 +268,7 @@ func (client *CapacityReservationsClient) getCreateRequest(ctx context.Context, if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,7 +286,7 @@ func (client *CapacityReservationsClient) getHandleResponse(resp *http.Response) // NewListByCapacityReservationGroupPager - Lists all of the capacity reservations in the specified capacity reservation group. // Use the nextLink property in the response to get the next page of capacity reservations. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - options - CapacityReservationsClientListByCapacityReservationGroupOptions contains the optional parameters for the CapacityReservationsClient.NewListByCapacityReservationGroupPager @@ -341,7 +341,7 @@ func (client *CapacityReservationsClient) listByCapacityReservationGroupCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -359,7 +359,7 @@ func (client *CapacityReservationsClient) listByCapacityReservationGroupHandleRe // BeginUpdate - The operation to update a capacity reservation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - capacityReservationName - The name of the capacity reservation. @@ -382,7 +382,7 @@ func (client *CapacityReservationsClient) BeginUpdate(ctx context.Context, resou // Update - The operation to update a capacity reservation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *CapacityReservationsClient) update(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CapacityReservationsClient.BeginUpdate" @@ -428,7 +428,7 @@ func (client *CapacityReservationsClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 729ac154f87b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go +++ /dev/null @@ -1,387 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json -func ExampleCapacityReservationsClient_BeginUpdate_capacityReservationUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/capacityReservationExamples/CapacityReservation_Update_MinimumSet_Gen.json -func ExampleCapacityReservationsClient_BeginUpdate_capacityReservationUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json -func ExampleCapacityReservationsClient_BeginDelete_capacityReservationDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json -func ExampleCapacityReservationsClient_BeginDelete_capacityReservationDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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"), - // 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{ - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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 a16505a4a6aa..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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 60739d06ab3a..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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 fdec5f3aec28..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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 0aa08c009892..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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 05d240badc36..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go deleted file mode 100644 index 46040ccc2f40..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go deleted file mode 100644 index 6fb79d9823ee..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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.CommunityGalleryImageIdentifier{ - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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.CommunityGalleryImageIdentifier{ - // 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_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go deleted file mode 100644 index 3b8261426ad0..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/constants.go b/sdk/resourcemanager/compute/armcompute/constants.go index 175956e91959..68e530e58323 100644 --- a/sdk/resourcemanager/compute/armcompute/constants.go +++ b/sdk/resourcemanager/compute/armcompute/constants.go @@ -10,7 +10,7 @@ package armcompute const ( moduleName = "armcompute" - moduleVersion = "v5.3.0-beta.1" + moduleVersion = "v5.3.0" ) type AccessLevel string diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go b/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go index 307887c3a54f..c3ee6dc78fc3 100644 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go @@ -48,7 +48,7 @@ func NewDedicatedHostGroupsClient(subscriptionID string, credential azcore.Token // see Dedicated Host Documentation [https://go.microsoft.com/fwlink/?linkid=2082596] // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - parameters - Parameters supplied to the Create Dedicated Host Group. @@ -96,7 +96,7 @@ func (client *DedicatedHostGroupsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -117,7 +117,7 @@ func (client *DedicatedHostGroupsClient) createOrUpdateHandleResponse(resp *http // Delete - Delete a dedicated host group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - options - DedicatedHostGroupsClientDeleteOptions contains the optional parameters for the DedicatedHostGroupsClient.Delete @@ -163,7 +163,7 @@ func (client *DedicatedHostGroupsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -172,7 +172,7 @@ func (client *DedicatedHostGroupsClient) deleteCreateRequest(ctx context.Context // Get - Retrieves information about a dedicated host group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - options - DedicatedHostGroupsClientGetOptions contains the optional parameters for the DedicatedHostGroupsClient.Get method. @@ -221,7 +221,7 @@ func (client *DedicatedHostGroupsClient) getCreateRequest(ctx context.Context, r if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,7 +239,7 @@ func (client *DedicatedHostGroupsClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Lists all of the dedicated host groups in the specified resource group. Use the nextLink // property in the response to get the next page of dedicated host groups. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - options - DedicatedHostGroupsClientListByResourceGroupOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListByResourceGroupPager // method. @@ -289,7 +289,7 @@ func (client *DedicatedHostGroupsClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -307,7 +307,7 @@ func (client *DedicatedHostGroupsClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Lists all of the dedicated host groups in the subscription. Use the nextLink property in the // response to get the next page of dedicated host groups. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - options - DedicatedHostGroupsClientListBySubscriptionOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListBySubscriptionPager // method. func (client *DedicatedHostGroupsClient) NewListBySubscriptionPager(options *DedicatedHostGroupsClientListBySubscriptionOptions) *runtime.Pager[DedicatedHostGroupsClientListBySubscriptionResponse] { @@ -352,7 +352,7 @@ func (client *DedicatedHostGroupsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -370,7 +370,7 @@ func (client *DedicatedHostGroupsClient) listBySubscriptionHandleResponse(resp * // Update - Update an dedicated host group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - parameters - Parameters supplied to the Update Dedicated Host Group operation. @@ -418,7 +418,7 @@ func (client *DedicatedHostGroupsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 dc85fbfa7332..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go +++ /dev/null @@ -1,620 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Update_dedicatedHostGroupUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_Update_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Update_dedicatedHostGroupUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Delete_dedicatedHostGroupDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Delete_dedicatedHostGroupDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListByResourceGroupPager_dedicatedHostGroupListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListByResourceGroupPager_dedicatedHostGroupListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go b/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go index 8dfff9e330b2..2323fd24b474 100644 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go +++ b/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go @@ -47,7 +47,7 @@ func NewDedicatedHostsClient(subscriptionID string, credential azcore.TokenCrede // BeginCreateOrUpdate - Create or update a dedicated host . // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - hostName - The name of the dedicated host . @@ -70,7 +70,7 @@ func (client *DedicatedHostsClient) BeginCreateOrUpdate(ctx context.Context, res // CreateOrUpdate - Create or update a dedicated host . // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *DedicatedHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DedicatedHostsClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *DedicatedHostsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -128,7 +128,7 @@ func (client *DedicatedHostsClient) createOrUpdateCreateRequest(ctx context.Cont // BeginDelete - Delete a dedicated host. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - hostName - The name of the dedicated host. @@ -150,7 +150,7 @@ func (client *DedicatedHostsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Delete a dedicated host. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *DedicatedHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DedicatedHostsClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *DedicatedHostsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *DedicatedHostsClient) deleteCreateRequest(ctx context.Context, res // Get - Retrieves information about a dedicated host. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - hostName - The name of the dedicated host. @@ -259,7 +259,7 @@ func (client *DedicatedHostsClient) getCreateRequest(ctx context.Context, resour if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -277,7 +277,7 @@ func (client *DedicatedHostsClient) getHandleResponse(resp *http.Response) (Dedi // NewListAvailableSizesPager - Lists all available dedicated host sizes to which the specified dedicated host can be resized. // NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated host. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - hostName - The name of the dedicated host. @@ -331,7 +331,7 @@ func (client *DedicatedHostsClient) listAvailableSizesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +349,7 @@ func (client *DedicatedHostsClient) listAvailableSizesHandleResponse(resp *http. // NewListByHostGroupPager - Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property // in the response to get the next page of dedicated hosts. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - options - DedicatedHostsClientListByHostGroupOptions contains the optional parameters for the DedicatedHostsClient.NewListByHostGroupPager @@ -404,7 +404,7 @@ func (client *DedicatedHostsClient) listByHostGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -425,7 +425,7 @@ func (client *DedicatedHostsClient) listByHostGroupHandleResponse(resp *http.Res // for more details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - hostName - The name of the dedicated host. @@ -450,7 +450,7 @@ func (client *DedicatedHostsClient) BeginRestart(ctx context.Context, resourceGr // for more details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *DedicatedHostsClient) restart(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "DedicatedHostsClient.BeginRestart" @@ -496,7 +496,7 @@ func (client *DedicatedHostsClient) restartCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -505,7 +505,7 @@ func (client *DedicatedHostsClient) restartCreateRequest(ctx context.Context, re // BeginUpdate - Update a dedicated host . // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - hostName - The name of the dedicated host . @@ -528,7 +528,7 @@ func (client *DedicatedHostsClient) BeginUpdate(ctx context.Context, resourceGro // Update - Update a dedicated host . // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *DedicatedHostsClient) update(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DedicatedHostsClient.BeginUpdate" @@ -574,7 +574,7 @@ func (client *DedicatedHostsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 8db8dc4c79d2..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go +++ /dev/null @@ -1,510 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHost_Update_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHost_Update_Resize.json -func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostUpdateResize() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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{ - 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"), - // 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}"), - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_BeginDelete_dedicatedHostDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_BeginDelete_dedicatedHostDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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: to.Ptr(armcompute.InstanceViewTypesInstanceView)}) - 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"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_NewListByHostGroupPager_dedicatedHostListByHostGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_NewListByHostGroupPager_dedicatedHostListByHostGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myHost"), - // Location: to.Ptr("westus"), - // SKU: &armcompute.SKU{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.json -func ExampleDedicatedHostsClient_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.NewDedicatedHostsClient().NewListAvailableSizesPager("myResourceGroup", "myDedicatedHostGroup", "myHost", 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.DedicatedHostSizeListResult = armcompute.DedicatedHostSizeListResult{ - // Value: []*string{ - // to.Ptr("Dsv3-Type1"), - // to.Ptr("Esv3-Type1")}, - // } - } -} 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 1d69487b6b64..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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 e1a40add3f1f..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go +++ /dev/null @@ -1,660 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // 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/{key}"), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // 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://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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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 5ce82618de75..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go +++ /dev/null @@ -1,184 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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), - FileFormat: to.Ptr(armcompute.FileFormatVHDX), - }, nil) - if err != nil { - log.Fatalf("failed 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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 1d1d0a8a390a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go +++ /dev/null @@ -1,2186 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromElasticSanVolumeSnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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.DiskCreateOptionCopyFromSanSnapshot), - SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed 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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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.DiskStorageAccountTypesPremiumV2LRS), - // Tier: to.Ptr("Premium"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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{ - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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{ - // LastOwnershipUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079872+00:00"); return t}()), - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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), - FileFormat: to.Ptr(armcompute.FileFormatVHD), - }, nil) - if err != nil { - log.Fatalf("failed 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/fake/availabilitysets_server.go b/sdk/resourcemanager/compute/armcompute/fake/availabilitysets_server.go index 36cda8f74298..64bca6bea7f2 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/availabilitysets_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/availabilitysets_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/capacityreservationgroups_server.go b/sdk/resourcemanager/compute/armcompute/fake/capacityreservationgroups_server.go index 65490fd75e3e..af39f1b50bb3 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/capacityreservationgroups_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/capacityreservationgroups_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/capacityreservations_server.go b/sdk/resourcemanager/compute/armcompute/fake/capacityreservations_server.go index b4c5ed78c9c6..87e9a817d026 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/capacityreservations_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/capacityreservations_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/cloudserviceoperatingsystems_server.go b/sdk/resourcemanager/compute/armcompute/fake/cloudserviceoperatingsystems_server.go index 90560e9c7010..a172632809dd 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/cloudserviceoperatingsystems_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/cloudserviceoperatingsystems_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/cloudserviceroleinstances_server.go b/sdk/resourcemanager/compute/armcompute/fake/cloudserviceroleinstances_server.go index 7df0bbefe418..28c426819aa0 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/cloudserviceroleinstances_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/cloudserviceroleinstances_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/cloudserviceroles_server.go b/sdk/resourcemanager/compute/armcompute/fake/cloudserviceroles_server.go index 88ca75fa1ec0..e8d054a55f63 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/cloudserviceroles_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/cloudserviceroles_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/cloudservices_server.go b/sdk/resourcemanager/compute/armcompute/fake/cloudservices_server.go index 3dd3344a5cf2..81a9756aa6db 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/cloudservices_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/cloudservices_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "reflect" diff --git a/sdk/resourcemanager/compute/armcompute/fake/cloudservicesupdatedomain_server.go b/sdk/resourcemanager/compute/armcompute/fake/cloudservicesupdatedomain_server.go index 13adfe659ac3..bc53619dc637 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/cloudservicesupdatedomain_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/cloudservicesupdatedomain_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/communitygalleries_server.go b/sdk/resourcemanager/compute/armcompute/fake/communitygalleries_server.go index 5bb42a3a53ef..8393238b4c14 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/communitygalleries_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/communitygalleries_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/communitygalleryimages_server.go b/sdk/resourcemanager/compute/armcompute/fake/communitygalleryimages_server.go index 312c99e7d2f9..cae1f44e8287 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/communitygalleryimages_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/communitygalleryimages_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/communitygalleryimageversions_server.go b/sdk/resourcemanager/compute/armcompute/fake/communitygalleryimageversions_server.go index b8b9f76e84ae..ffdb005d6287 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/communitygalleryimageversions_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/communitygalleryimageversions_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/dedicatedhostgroups_server.go b/sdk/resourcemanager/compute/armcompute/fake/dedicatedhostgroups_server.go index 0d93d8e9b214..92fb73aef075 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/dedicatedhostgroups_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/dedicatedhostgroups_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/dedicatedhosts_server.go b/sdk/resourcemanager/compute/armcompute/fake/dedicatedhosts_server.go index fbf3347df248..e23f7d6c7c6f 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/dedicatedhosts_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/dedicatedhosts_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/diskaccesses_server.go b/sdk/resourcemanager/compute/armcompute/fake/diskaccesses_server.go index 2c5c63532811..661dec8968ff 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/diskaccesses_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/diskaccesses_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/diskencryptionsets_server.go b/sdk/resourcemanager/compute/armcompute/fake/diskencryptionsets_server.go index bc5c3950b2f7..f92040649be4 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/diskencryptionsets_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/diskencryptionsets_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/diskrestorepoint_server.go b/sdk/resourcemanager/compute/armcompute/fake/diskrestorepoint_server.go index ab13ab0ecb00..daa2e488657e 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/diskrestorepoint_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/diskrestorepoint_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/disks_server.go b/sdk/resourcemanager/compute/armcompute/fake/disks_server.go index ce15abbeb8ea..21625ab34198 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/disks_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/disks_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/galleries_server.go b/sdk/resourcemanager/compute/armcompute/fake/galleries_server.go index 64bc25ad5505..5bf435c5314e 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/galleries_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/galleries_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/galleryapplications_server.go b/sdk/resourcemanager/compute/armcompute/fake/galleryapplications_server.go index 9d47d99aeb4d..a9ccf360574d 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/galleryapplications_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/galleryapplications_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/galleryapplicationversions_server.go b/sdk/resourcemanager/compute/armcompute/fake/galleryapplicationversions_server.go index b55f9b2c2184..1f1640a997a2 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/galleryapplicationversions_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/galleryapplicationversions_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/galleryimages_server.go b/sdk/resourcemanager/compute/armcompute/fake/galleryimages_server.go index 97a80524a6c3..3ebe621377b2 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/galleryimages_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/galleryimages_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/galleryimageversions_server.go b/sdk/resourcemanager/compute/armcompute/fake/galleryimageversions_server.go index 7910745d33b7..2e5f6530310d 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/galleryimageversions_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/galleryimageversions_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/gallerysharingprofile_server.go b/sdk/resourcemanager/compute/armcompute/fake/gallerysharingprofile_server.go index 716a34b8c610..163ca3581709 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/gallerysharingprofile_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/gallerysharingprofile_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/images_server.go b/sdk/resourcemanager/compute/armcompute/fake/images_server.go index ac5545531632..38e88498e2b7 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/images_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/images_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/loganalytics_server.go b/sdk/resourcemanager/compute/armcompute/fake/loganalytics_server.go index 6e1539b65eda..b63115859664 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/loganalytics_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/loganalytics_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/operations_server.go b/sdk/resourcemanager/compute/armcompute/fake/operations_server.go index 103898c5c4be..a7d5d349b6b1 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/operations_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/operations_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" ) diff --git a/sdk/resourcemanager/compute/armcompute/fake/proximityplacementgroups_server.go b/sdk/resourcemanager/compute/armcompute/fake/proximityplacementgroups_server.go index 8a0fdbb50f6d..9d9ac178f93e 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/proximityplacementgroups_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/proximityplacementgroups_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/resourceskus_server.go b/sdk/resourcemanager/compute/armcompute/fake/resourceskus_server.go index f5d5815f8745..89b14c35751b 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/resourceskus_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/resourceskus_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/restorepointcollections_server.go b/sdk/resourcemanager/compute/armcompute/fake/restorepointcollections_server.go index 2555729d7aec..d00c43648ec6 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/restorepointcollections_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/restorepointcollections_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/restorepoints_server.go b/sdk/resourcemanager/compute/armcompute/fake/restorepoints_server.go index 49957d1ee68b..508441421608 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/restorepoints_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/restorepoints_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/sharedgalleries_server.go b/sdk/resourcemanager/compute/armcompute/fake/sharedgalleries_server.go index 39d5b2b2752e..ba0f60905fd2 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/sharedgalleries_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/sharedgalleries_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/sharedgalleryimages_server.go b/sdk/resourcemanager/compute/armcompute/fake/sharedgalleryimages_server.go index c33992b1c2ce..fe8902eb6935 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/sharedgalleryimages_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/sharedgalleryimages_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/sharedgalleryimageversions_server.go b/sdk/resourcemanager/compute/armcompute/fake/sharedgalleryimageversions_server.go index bbacf3863a75..91a64354c24d 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/sharedgalleryimageversions_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/sharedgalleryimageversions_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/snapshots_server.go b/sdk/resourcemanager/compute/armcompute/fake/snapshots_server.go index c298edaaf33e..e70a8ae484a5 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/snapshots_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/snapshots_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/sshpublickeys_server.go b/sdk/resourcemanager/compute/armcompute/fake/sshpublickeys_server.go index 4eeb43c4c6bb..5a1b1881ca39 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/sshpublickeys_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/sshpublickeys_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/usage_server.go b/sdk/resourcemanager/compute/armcompute/fake/usage_server.go index 46ea1ef76460..3eb1b0bc62b0 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/usage_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/usage_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachineextensionimages_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachineextensionimages_server.go index de86f645a0de..ce947cc92d8d 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachineextensionimages_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachineextensionimages_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachineextensions_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachineextensions_server.go index c656ec6111e2..6fa15b9bcdbe 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachineextensions_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachineextensions_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachineimages_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachineimages_server.go index 1c7588a978c9..58db82815f7a 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachineimages_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachineimages_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachineimagesedgezone_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachineimagesedgezone_server.go index 717058022f39..c03f3e9d2394 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachineimagesedgezone_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachineimagesedgezone_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachineruncommands_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachineruncommands_server.go index 15f9cfc8ebde..ac558fa8478f 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachineruncommands_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachineruncommands_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachines_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachines_server.go index 1a4e1195900a..31d521b1bd3f 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachines_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachines_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "reflect" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetextensions_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetextensions_server.go index a1b4bc7d0e1f..2489bb1803df 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetextensions_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetextensions_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetrollingupgrades_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetrollingupgrades_server.go index 664c480a64fd..59015163733b 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetrollingupgrades_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetrollingupgrades_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesets_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesets_server.go index bdd7a3e3f66a..568f1ba0e1e7 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesets_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesets_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "reflect" @@ -26,6 +26,10 @@ import ( // VirtualMachineScaleSetsServer is a fake server for instances of the armcompute.VirtualMachineScaleSetsClient type. type VirtualMachineScaleSetsServer struct { + // BeginApproveRollingUpgrade is the fake for method VirtualMachineScaleSetsClient.BeginApproveRollingUpgrade + // HTTP status codes to indicate success: http.StatusAccepted + BeginApproveRollingUpgrade func(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *armcompute.VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions) (resp azfake.PollerResponder[armcompute.VirtualMachineScaleSetsClientApproveRollingUpgradeResponse], errResp azfake.ErrorResponder) + // ConvertToSinglePlacementGroup is the fake for method VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup // HTTP status codes to indicate success: http.StatusOK ConvertToSinglePlacementGroup func(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters armcompute.VMScaleSetConvertToSinglePlacementGroupInput, options *armcompute.VirtualMachineScaleSetsClientConvertToSinglePlacementGroupOptions) (resp azfake.Responder[armcompute.VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse], errResp azfake.ErrorResponder) @@ -129,6 +133,7 @@ type VirtualMachineScaleSetsServer struct { func NewVirtualMachineScaleSetsServerTransport(srv *VirtualMachineScaleSetsServer) *VirtualMachineScaleSetsServerTransport { return &VirtualMachineScaleSetsServerTransport{ srv: srv, + beginApproveRollingUpgrade: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetsClientApproveRollingUpgradeResponse]](), beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetsClientCreateOrUpdateResponse]](), beginDeallocate: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetsClientDeallocateResponse]](), beginDelete: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetsClientDeleteResponse]](), @@ -156,6 +161,7 @@ func NewVirtualMachineScaleSetsServerTransport(srv *VirtualMachineScaleSetsServe // Don't use this type directly, use NewVirtualMachineScaleSetsServerTransport instead. type VirtualMachineScaleSetsServerTransport struct { srv *VirtualMachineScaleSetsServer + beginApproveRollingUpgrade *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetsClientApproveRollingUpgradeResponse]] beginCreateOrUpdate *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetsClientCreateOrUpdateResponse]] beginDeallocate *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetsClientDeallocateResponse]] beginDelete *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetsClientDeleteResponse]] @@ -190,6 +196,8 @@ func (v *VirtualMachineScaleSetsServerTransport) Do(req *http.Request) (*http.Re var err error switch method { + case "VirtualMachineScaleSetsClient.BeginApproveRollingUpgrade": + resp, err = v.dispatchBeginApproveRollingUpgrade(req) case "VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup": resp, err = v.dispatchConvertToSinglePlacementGroup(req) case "VirtualMachineScaleSetsClient.BeginCreateOrUpdate": @@ -249,6 +257,60 @@ func (v *VirtualMachineScaleSetsServerTransport) Do(req *http.Request) (*http.Re return resp, nil } +func (v *VirtualMachineScaleSetsServerTransport) dispatchBeginApproveRollingUpgrade(req *http.Request) (*http.Response, error) { + if v.srv.BeginApproveRollingUpgrade == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginApproveRollingUpgrade not implemented")} + } + beginApproveRollingUpgrade := v.beginApproveRollingUpgrade.get(req) + if beginApproveRollingUpgrade == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Compute/virtualMachineScaleSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/approveRollingUpgrade` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcompute.VirtualMachineScaleSetVMInstanceIDs](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vmScaleSetNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("vmScaleSetName")]) + if err != nil { + return nil, err + } + var options *armcompute.VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions + if !reflect.ValueOf(body).IsZero() { + options = &armcompute.VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions{ + VMInstanceIDs: &body, + } + } + respr, errRespr := v.srv.BeginApproveRollingUpgrade(req.Context(), resourceGroupNameUnescaped, vmScaleSetNameUnescaped, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginApproveRollingUpgrade = &respr + v.beginApproveRollingUpgrade.add(req, beginApproveRollingUpgrade) + } + + resp, err := server.PollerResponderNext(beginApproveRollingUpgrade, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + v.beginApproveRollingUpgrade.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginApproveRollingUpgrade) { + v.beginApproveRollingUpgrade.remove(req) + } + + return resp, nil +} + func (v *VirtualMachineScaleSetsServerTransport) dispatchConvertToSinglePlacementGroup(req *http.Request) (*http.Response, error) { if v.srv.ConvertToSinglePlacementGroup == nil { return nil, &nonRetriableError{errors.New("fake for method ConvertToSinglePlacementGroup not implemented")} diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvmextensions_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvmextensions_server.go index 6719e1797e2b..343649c23a1a 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvmextensions_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvmextensions_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvmruncommands_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvmruncommands_server.go index 239f9b666725..fc8d9f4d3f08 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvmruncommands_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvmruncommands_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvms_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvms_server.go index 8b54f4b467f4..0256f1601dd8 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvms_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinescalesetvms_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "reflect" @@ -26,6 +26,10 @@ import ( // VirtualMachineScaleSetVMsServer is a fake server for instances of the armcompute.VirtualMachineScaleSetVMsClient type. type VirtualMachineScaleSetVMsServer struct { + // BeginApproveRollingUpgrade is the fake for method VirtualMachineScaleSetVMsClient.BeginApproveRollingUpgrade + // HTTP status codes to indicate success: http.StatusAccepted + BeginApproveRollingUpgrade func(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *armcompute.VirtualMachineScaleSetVMsClientBeginApproveRollingUpgradeOptions) (resp azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientApproveRollingUpgradeResponse], errResp azfake.ErrorResponder) + // BeginDeallocate is the fake for method VirtualMachineScaleSetVMsClient.BeginDeallocate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginDeallocate func(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *armcompute.VirtualMachineScaleSetVMsClientBeginDeallocateOptions) (resp azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientDeallocateResponse], errResp azfake.ErrorResponder) @@ -96,38 +100,40 @@ type VirtualMachineScaleSetVMsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewVirtualMachineScaleSetVMsServerTransport(srv *VirtualMachineScaleSetVMsServer) *VirtualMachineScaleSetVMsServerTransport { return &VirtualMachineScaleSetVMsServerTransport{ - srv: srv, - beginDeallocate: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientDeallocateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcompute.VirtualMachineScaleSetVMsClientListResponse]](), - beginPerformMaintenance: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientPerformMaintenanceResponse]](), - beginPowerOff: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientPowerOffResponse]](), - beginRedeploy: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRedeployResponse]](), - beginReimage: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientReimageResponse]](), - beginReimageAll: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientReimageAllResponse]](), - beginRestart: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRestartResponse]](), - beginRunCommand: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRunCommandResponse]](), - beginStart: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientStartResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientUpdateResponse]](), + srv: srv, + beginApproveRollingUpgrade: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientApproveRollingUpgradeResponse]](), + beginDeallocate: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientDeallocateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcompute.VirtualMachineScaleSetVMsClientListResponse]](), + beginPerformMaintenance: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientPerformMaintenanceResponse]](), + beginPowerOff: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientPowerOffResponse]](), + beginRedeploy: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRedeployResponse]](), + beginReimage: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientReimageResponse]](), + beginReimageAll: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientReimageAllResponse]](), + beginRestart: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRestartResponse]](), + beginRunCommand: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRunCommandResponse]](), + beginStart: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientStartResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientUpdateResponse]](), } } // VirtualMachineScaleSetVMsServerTransport connects instances of armcompute.VirtualMachineScaleSetVMsClient to instances of VirtualMachineScaleSetVMsServer. // Don't use this type directly, use NewVirtualMachineScaleSetVMsServerTransport instead. type VirtualMachineScaleSetVMsServerTransport struct { - srv *VirtualMachineScaleSetVMsServer - beginDeallocate *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientDeallocateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcompute.VirtualMachineScaleSetVMsClientListResponse]] - beginPerformMaintenance *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientPerformMaintenanceResponse]] - beginPowerOff *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientPowerOffResponse]] - beginRedeploy *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRedeployResponse]] - beginReimage *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientReimageResponse]] - beginReimageAll *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientReimageAllResponse]] - beginRestart *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRestartResponse]] - beginRunCommand *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRunCommandResponse]] - beginStart *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientStartResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientUpdateResponse]] + srv *VirtualMachineScaleSetVMsServer + beginApproveRollingUpgrade *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientApproveRollingUpgradeResponse]] + beginDeallocate *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientDeallocateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armcompute.VirtualMachineScaleSetVMsClientListResponse]] + beginPerformMaintenance *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientPerformMaintenanceResponse]] + beginPowerOff *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientPowerOffResponse]] + beginRedeploy *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRedeployResponse]] + beginReimage *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientReimageResponse]] + beginReimageAll *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientReimageAllResponse]] + beginRestart *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRestartResponse]] + beginRunCommand *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientRunCommandResponse]] + beginStart *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientStartResponse]] + beginUpdate *tracker[azfake.PollerResponder[armcompute.VirtualMachineScaleSetVMsClientUpdateResponse]] } // Do implements the policy.Transporter interface for VirtualMachineScaleSetVMsServerTransport. @@ -142,6 +148,8 @@ func (v *VirtualMachineScaleSetVMsServerTransport) Do(req *http.Request) (*http. var err error switch method { + case "VirtualMachineScaleSetVMsClient.BeginApproveRollingUpgrade": + resp, err = v.dispatchBeginApproveRollingUpgrade(req) case "VirtualMachineScaleSetVMsClient.BeginDeallocate": resp, err = v.dispatchBeginDeallocate(req) case "VirtualMachineScaleSetVMsClient.BeginDelete": @@ -185,6 +193,54 @@ func (v *VirtualMachineScaleSetVMsServerTransport) Do(req *http.Request) (*http. return resp, nil } +func (v *VirtualMachineScaleSetVMsServerTransport) dispatchBeginApproveRollingUpgrade(req *http.Request) (*http.Response, error) { + if v.srv.BeginApproveRollingUpgrade == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginApproveRollingUpgrade not implemented")} + } + beginApproveRollingUpgrade := v.beginApproveRollingUpgrade.get(req) + if beginApproveRollingUpgrade == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Compute/virtualMachineScaleSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/approveRollingUpgrade` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vmScaleSetNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("vmScaleSetName")]) + if err != nil { + return nil, err + } + instanceIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("instanceId")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginApproveRollingUpgrade(req.Context(), resourceGroupNameUnescaped, vmScaleSetNameUnescaped, instanceIDUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginApproveRollingUpgrade = &respr + v.beginApproveRollingUpgrade.add(req, beginApproveRollingUpgrade) + } + + resp, err := server.PollerResponderNext(beginApproveRollingUpgrade, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + v.beginApproveRollingUpgrade.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginApproveRollingUpgrade) { + v.beginApproveRollingUpgrade.remove(req) + } + + return resp, nil +} + func (v *VirtualMachineScaleSetVMsServerTransport) dispatchBeginDeallocate(req *http.Request) (*http.Response, error) { if v.srv.BeginDeallocate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginDeallocate not implemented")} diff --git a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinesizes_server.go b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinesizes_server.go index 20f0649f4eb3..921d84f2b0f8 100644 --- a/sdk/resourcemanager/compute/armcompute/fake/virtualmachinesizes_server.go +++ b/sdk/resourcemanager/compute/armcompute/fake/virtualmachinesizes_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "net/http" "net/url" "regexp" 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 c714f4e6a0fb..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/galleryapplications_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go deleted file mode 100644 index 18141b4b695b..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go deleted file mode 100644 index 49e884099674..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go deleted file mode 100644 index 6068107098c9..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go deleted file mode 100644 index e418883de308..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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.EdgeZoneStorageAccountType("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.EdgeZoneStorageAccountType("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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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_example_test.go b/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go deleted file mode 100644 index 4e171d67833a..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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 6630cd864bcb..43d5a774f86e 100644 --- a/sdk/resourcemanager/compute/armcompute/go.mod +++ b/sdk/resourcemanager/compute/armcompute/go.mod @@ -4,14 +4,15 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.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/azidentity v1.2.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.1.0 // indirect diff --git a/sdk/resourcemanager/compute/armcompute/go.sum b/sdk/resourcemanager/compute/armcompute/go.sum index 03b70f56b685..c859bbef4b96 100644 --- a/sdk/resourcemanager/compute/armcompute/go.sum +++ b/sdk/resourcemanager/compute/armcompute/go.sum @@ -4,9 +4,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0 h1:/Di3vB4sNeQ+7A8efjUVENvyB945Wruvstucqp7ZArg= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0/go.mod h1:gM3K25LQlsET3QR+4V74zxCsFAy0r6xMNN9n80SZn+4= 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/network/armnetwork v1.0.0 h1:nBy98uKOIfun5z6wx6jwWLrULcM0+cjBalBFZlEZ7CA= 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.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= diff --git a/sdk/resourcemanager/compute/armcompute/images_client.go b/sdk/resourcemanager/compute/armcompute/images_client.go index 041b03ab3e5d..cd3b69926645 100644 --- a/sdk/resourcemanager/compute/armcompute/images_client.go +++ b/sdk/resourcemanager/compute/armcompute/images_client.go @@ -47,7 +47,7 @@ func NewImagesClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Create or update an image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - imageName - The name of the image. // - parameters - Parameters supplied to the Create Image operation. @@ -69,7 +69,7 @@ func (client *ImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Create or update an image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *ImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ImagesClient.BeginCreateOrUpdate" @@ -111,7 +111,7 @@ func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -123,7 +123,7 @@ func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDelete - Deletes an Image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - imageName - The name of the image. // - options - ImagesClientBeginDeleteOptions contains the optional parameters for the ImagesClient.BeginDelete method. @@ -143,7 +143,7 @@ func (client *ImagesClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Deletes an Image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *ImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ImagesClient.BeginDelete" @@ -185,7 +185,7 @@ func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -194,7 +194,7 @@ func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets an image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - imageName - The name of the image. // - options - ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. @@ -243,7 +243,7 @@ func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupN if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +261,7 @@ func (client *ImagesClient) getHandleResponse(resp *http.Response) (ImagesClient // NewListPager - Gets the list of Images in the subscription. Use nextLink property in the response to get the next page // of Images. Do this till nextLink is null to fetch all the Images. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - options - ImagesClientListOptions contains the optional parameters for the ImagesClient.NewListPager method. func (client *ImagesClient) NewListPager(options *ImagesClientListOptions) *runtime.Pager[ImagesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ImagesClientListResponse]{ @@ -305,7 +305,7 @@ func (client *ImagesClient) listCreateRequest(ctx context.Context, options *Imag return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,7 +323,7 @@ func (client *ImagesClient) listHandleResponse(resp *http.Response) (ImagesClien // NewListByResourceGroupPager - Gets the list of images under a resource group. Use nextLink property in the response to // get the next page of Images. Do this till nextLink is null to fetch all the Images. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - options - ImagesClientListByResourceGroupOptions contains the optional parameters for the ImagesClient.NewListByResourceGroupPager // method. @@ -373,7 +373,7 @@ func (client *ImagesClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -391,7 +391,7 @@ func (client *ImagesClient) listByResourceGroupHandleResponse(resp *http.Respons // BeginUpdate - Update an image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - imageName - The name of the image. // - parameters - Parameters supplied to the Update Image operation. @@ -412,7 +412,7 @@ func (client *ImagesClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Update an image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *ImagesClient) update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ImagesClient.BeginUpdate" @@ -454,7 +454,7 @@ func (client *ImagesClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 076b321d9e9c..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/imageExamples/Images_Delete_MaximumSet_Gen.json -func ExampleImagesClient_BeginDelete_imageDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/imageExamples/Images_Delete_MinimumSet_Gen.json -func ExampleImagesClient_BeginDelete_imageDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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.go b/sdk/resourcemanager/compute/armcompute/loganalytics_client.go index 72819b4e3b27..b45ff067a76e 100644 --- a/sdk/resourcemanager/compute/armcompute/loganalytics_client.go +++ b/sdk/resourcemanager/compute/armcompute/loganalytics_client.go @@ -48,7 +48,7 @@ func NewLogAnalyticsClient(subscriptionID string, credential azcore.TokenCredent // to show throttling activities. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The location upon which virtual-machine-sizes is queried. // - parameters - Parameters supplied to the LogAnalytics getRequestRateByInterval Api. // - options - LogAnalyticsClientBeginExportRequestRateByIntervalOptions contains the optional parameters for the LogAnalyticsClient.BeginExportRequestRateByInterval @@ -72,7 +72,7 @@ func (client *LogAnalyticsClient) BeginExportRequestRateByInterval(ctx context.C // show throttling activities. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *LogAnalyticsClient) exportRequestRateByInterval(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsClientBeginExportRequestRateByIntervalOptions) (*http.Response, error) { var err error const operationName = "LogAnalyticsClient.BeginExportRequestRateByInterval" @@ -110,7 +110,7 @@ func (client *LogAnalyticsClient) exportRequestRateByIntervalCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -123,7 +123,7 @@ func (client *LogAnalyticsClient) exportRequestRateByIntervalCreateRequest(ctx c // window. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The location upon which virtual-machine-sizes is queried. // - parameters - Parameters supplied to the LogAnalytics getThrottledRequests Api. // - options - LogAnalyticsClientBeginExportThrottledRequestsOptions contains the optional parameters for the LogAnalyticsClient.BeginExportThrottledRequests @@ -146,7 +146,7 @@ func (client *LogAnalyticsClient) BeginExportThrottledRequests(ctx context.Conte // ExportThrottledRequests - Export logs that show total throttled Api requests for this subscription in the given time window. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *LogAnalyticsClient) exportThrottledRequests(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsClientBeginExportThrottledRequestsOptions) (*http.Response, error) { var err error const operationName = "LogAnalyticsClient.BeginExportThrottledRequests" @@ -184,7 +184,7 @@ func (client *LogAnalyticsClient) exportThrottledRequestsCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 76d6b89f8bf0..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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 8275c77915db..57654b8b919e 100644 --- a/sdk/resourcemanager/compute/armcompute/models.go +++ b/sdk/resourcemanager/compute/armcompute/models.go @@ -113,6 +113,11 @@ type AutomaticOSUpgradePolicy struct { // is automatically set to false and cannot be set to true. EnableAutomaticOSUpgrade *bool + // Indicates whether Auto OS Upgrade should undergo deferral. Deferred OS upgrades will send advanced notifications on a per-VM + // basis that an OS upgrade from rolling upgrades is incoming, via the IMDS + // tag 'Platform.PendingOSUpgrade'. The upgrade then defers until the upgrade is approved via an ApproveRollingUpgrade call. + OSRollingUpgradeDeferral *bool + // Indicates whether rolling upgrade policy should be used during Auto OS Upgrade. Default value is false. Auto OS Upgrade // will fallback to the default policy if no policy is defined on the VMSS. UseRollingUpgradePolicy *bool diff --git a/sdk/resourcemanager/compute/armcompute/models_serde.go b/sdk/resourcemanager/compute/armcompute/models_serde.go index eb6a5f3aa70f..ba188fbf8058 100644 --- a/sdk/resourcemanager/compute/armcompute/models_serde.go +++ b/sdk/resourcemanager/compute/armcompute/models_serde.go @@ -284,6 +284,7 @@ func (a AutomaticOSUpgradePolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "disableAutomaticRollback", a.DisableAutomaticRollback) populate(objectMap, "enableAutomaticOSUpgrade", a.EnableAutomaticOSUpgrade) + populate(objectMap, "osRollingUpgradeDeferral", a.OSRollingUpgradeDeferral) populate(objectMap, "useRollingUpgradePolicy", a.UseRollingUpgradePolicy) return json.Marshal(objectMap) } @@ -303,6 +304,9 @@ func (a *AutomaticOSUpgradePolicy) UnmarshalJSON(data []byte) error { case "enableAutomaticOSUpgrade": err = unpopulate(val, "EnableAutomaticOSUpgrade", &a.EnableAutomaticOSUpgrade) delete(rawMsg, key) + case "osRollingUpgradeDeferral": + err = unpopulate(val, "OSRollingUpgradeDeferral", &a.OSRollingUpgradeDeferral) + delete(rawMsg, key) case "useRollingUpgradePolicy": err = unpopulate(val, "UseRollingUpgradePolicy", &a.UseRollingUpgradePolicy) delete(rawMsg, key) diff --git a/sdk/resourcemanager/compute/armcompute/operations_client.go b/sdk/resourcemanager/compute/armcompute/operations_client.go index 088244df6d1c..59acc82c0839 100644 --- a/sdk/resourcemanager/compute/armcompute/operations_client.go +++ b/sdk/resourcemanager/compute/armcompute/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Gets a list of compute operations. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -73,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 a28fd04ccba8..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/options.go b/sdk/resourcemanager/compute/armcompute/options.go index 39d7b0f15d02..f05bb023c51a 100644 --- a/sdk/resourcemanager/compute/armcompute/options.go +++ b/sdk/resourcemanager/compute/armcompute/options.go @@ -1375,6 +1375,13 @@ type VirtualMachineScaleSetVMRunCommandsClientListOptions struct { Expand *string } +// VirtualMachineScaleSetVMsClientBeginApproveRollingUpgradeOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginApproveRollingUpgrade +// method. +type VirtualMachineScaleSetVMsClientBeginApproveRollingUpgradeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // VirtualMachineScaleSetVMsClientBeginDeallocateOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginDeallocate // method. type VirtualMachineScaleSetVMsClientBeginDeallocateOptions struct { @@ -1505,6 +1512,16 @@ type VirtualMachineScaleSetVMsClientSimulateEvictionOptions struct { // placeholder for future optional parameters } +// VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginApproveRollingUpgrade +// method. +type VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + + // A list of virtual machine instance IDs from the VM scale set. + VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs +} + // VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginCreateOrUpdate // method. type VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go b/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go index 1030a841866c..e63ba9fa9af3 100644 --- a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go @@ -47,7 +47,7 @@ func NewProximityPlacementGroupsClient(subscriptionID string, credential azcore. // CreateOrUpdate - Create or update a proximity placement group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - proximityPlacementGroupName - The name of the proximity placement group. // - parameters - Parameters supplied to the Create Proximity Placement Group operation. @@ -95,7 +95,7 @@ func (client *ProximityPlacementGroupsClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -116,7 +116,7 @@ func (client *ProximityPlacementGroupsClient) createOrUpdateHandleResponse(resp // Delete - Delete a proximity placement group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - proximityPlacementGroupName - The name of the proximity placement group. // - options - ProximityPlacementGroupsClientDeleteOptions contains the optional parameters for the ProximityPlacementGroupsClient.Delete @@ -162,7 +162,7 @@ func (client *ProximityPlacementGroupsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,7 +171,7 @@ func (client *ProximityPlacementGroupsClient) deleteCreateRequest(ctx context.Co // Get - Retrieves information about a proximity placement group . // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - proximityPlacementGroupName - The name of the proximity placement group. // - options - ProximityPlacementGroupsClientGetOptions contains the optional parameters for the ProximityPlacementGroupsClient.Get @@ -221,7 +221,7 @@ func (client *ProximityPlacementGroupsClient) getCreateRequest(ctx context.Conte if options != nil && options.IncludeColocationStatus != nil { reqQP.Set("includeColocationStatus", *options.IncludeColocationStatus) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,7 +238,7 @@ func (client *ProximityPlacementGroupsClient) getHandleResponse(resp *http.Respo // NewListByResourceGroupPager - Lists all proximity placement groups in a resource group. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - options - ProximityPlacementGroupsClientListByResourceGroupOptions contains the optional parameters for the ProximityPlacementGroupsClient.NewListByResourceGroupPager // method. @@ -288,7 +288,7 @@ func (client *ProximityPlacementGroupsClient) listByResourceGroupCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -305,7 +305,7 @@ func (client *ProximityPlacementGroupsClient) listByResourceGroupHandleResponse( // NewListBySubscriptionPager - Lists all proximity placement groups in a subscription. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - options - ProximityPlacementGroupsClientListBySubscriptionOptions contains the optional parameters for the ProximityPlacementGroupsClient.NewListBySubscriptionPager // method. func (client *ProximityPlacementGroupsClient) NewListBySubscriptionPager(options *ProximityPlacementGroupsClientListBySubscriptionOptions) *runtime.Pager[ProximityPlacementGroupsClientListBySubscriptionResponse] { @@ -350,7 +350,7 @@ func (client *ProximityPlacementGroupsClient) listBySubscriptionCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -368,7 +368,7 @@ func (client *ProximityPlacementGroupsClient) listBySubscriptionHandleResponse(r // Update - Update a proximity placement group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - proximityPlacementGroupName - The name of the proximity placement group. // - parameters - Parameters supplied to the Update Proximity Placement Group operation. @@ -416,7 +416,7 @@ func (client *ProximityPlacementGroupsClient) updateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 58aad08b7050..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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 82e039ce5621..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/response_types.go b/sdk/resourcemanager/compute/armcompute/response_types.go index 360dfc34bd94..0bf1a0d4c2e5 100644 --- a/sdk/resourcemanager/compute/armcompute/response_types.go +++ b/sdk/resourcemanager/compute/armcompute/response_types.go @@ -1286,6 +1286,11 @@ type VirtualMachineScaleSetVMRunCommandsClientUpdateResponse struct { VirtualMachineRunCommand } +// VirtualMachineScaleSetVMsClientApproveRollingUpgradeResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginApproveRollingUpgrade. +type VirtualMachineScaleSetVMsClientApproveRollingUpgradeResponse struct { + // placeholder for future response values +} + // VirtualMachineScaleSetVMsClientDeallocateResponse contains the response from method VirtualMachineScaleSetVMsClient.BeginDeallocate. type VirtualMachineScaleSetVMsClientDeallocateResponse struct { // placeholder for future response values @@ -1371,6 +1376,11 @@ type VirtualMachineScaleSetVMsClientUpdateResponse struct { VirtualMachineScaleSetVM } +// VirtualMachineScaleSetsClientApproveRollingUpgradeResponse contains the response from method VirtualMachineScaleSetsClient.BeginApproveRollingUpgrade. +type VirtualMachineScaleSetsClientApproveRollingUpgradeResponse struct { + // placeholder for future response values +} + // VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse contains the response from method VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup. type VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse struct { // placeholder for future response values diff --git a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client.go b/sdk/resourcemanager/compute/armcompute/restorepointcollections_client.go index 48edc5471450..9beba372150a 100644 --- a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client.go +++ b/sdk/resourcemanager/compute/armcompute/restorepointcollections_client.go @@ -48,7 +48,7 @@ func NewRestorePointCollectionsClient(subscriptionID string, credential azcore.T // for more details. When updating a restore point collection, only tags may be modified. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - restorePointCollectionName - The name of the restore point collection. // - parameters - Parameters supplied to the Create or Update restore point collection operation. @@ -96,7 +96,7 @@ func (client *RestorePointCollectionsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -118,7 +118,7 @@ func (client *RestorePointCollectionsClient) createOrUpdateHandleResponse(resp * // points. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - restorePointCollectionName - The name of the Restore Point Collection. // - options - RestorePointCollectionsClientBeginDeleteOptions contains the optional parameters for the RestorePointCollectionsClient.BeginDelete @@ -140,7 +140,7 @@ func (client *RestorePointCollectionsClient) BeginDelete(ctx context.Context, re // points. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *RestorePointCollectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RestorePointCollectionsClient.BeginDelete" @@ -182,7 +182,7 @@ func (client *RestorePointCollectionsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ func (client *RestorePointCollectionsClient) deleteCreateRequest(ctx context.Con // Get - The operation to get the restore point collection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - restorePointCollectionName - The name of the restore point collection. // - options - RestorePointCollectionsClientGetOptions contains the optional parameters for the RestorePointCollectionsClient.Get @@ -241,7 +241,7 @@ func (client *RestorePointCollectionsClient) getCreateRequest(ctx context.Contex if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,7 +258,7 @@ func (client *RestorePointCollectionsClient) getHandleResponse(resp *http.Respon // NewListPager - Gets the list of restore point collections in a resource group. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - options - RestorePointCollectionsClientListOptions contains the optional parameters for the RestorePointCollectionsClient.NewListPager // method. @@ -308,7 +308,7 @@ func (client *RestorePointCollectionsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -327,7 +327,7 @@ func (client *RestorePointCollectionsClient) listHandleResponse(resp *http.Respo // to get the next page of restore point collections. Do this till nextLink is not null to fetch all // the restore point collections. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - options - RestorePointCollectionsClientListAllOptions contains the optional parameters for the RestorePointCollectionsClient.NewListAllPager // method. func (client *RestorePointCollectionsClient) NewListAllPager(options *RestorePointCollectionsClientListAllOptions) *runtime.Pager[RestorePointCollectionsClientListAllResponse] { @@ -372,7 +372,7 @@ func (client *RestorePointCollectionsClient) listAllCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -390,7 +390,7 @@ func (client *RestorePointCollectionsClient) listAllHandleResponse(resp *http.Re // Update - The operation to update the restore point collection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - restorePointCollectionName - The name of the restore point collection. // - parameters - Parameters supplied to the Update restore point collection operation. @@ -438,7 +438,7 @@ func (client *RestorePointCollectionsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 2838bbfc4a58..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/restorePointExamples/RestorePointCollection_Update_MaximumSet_Gen.json -func ExampleRestorePointCollectionsClient_Update_restorePointCollectionUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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.DiskRestorePointAttributes{ - // 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.DiskRestorePointAttributes{ - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/restorePointExamples/RestorePointCollection_Update_MinimumSet_Gen.json -func ExampleRestorePointCollectionsClient_Update_restorePointCollectionUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/restorePointExamples/RestorePointCollection_Delete_MaximumSet_Gen.json -func ExampleRestorePointCollectionsClient_BeginDelete_restorePointCollectionDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/restorePointExamples/RestorePointCollection_Delete_MinimumSet_Gen.json -func ExampleRestorePointCollectionsClient_BeginDelete_restorePointCollectionDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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.DiskRestorePointAttributes{ - // 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.DiskRestorePointAttributes{ - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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.go b/sdk/resourcemanager/compute/armcompute/restorepoints_client.go index 83862669d873..128a70373d1a 100644 --- a/sdk/resourcemanager/compute/armcompute/restorepoints_client.go +++ b/sdk/resourcemanager/compute/armcompute/restorepoints_client.go @@ -47,7 +47,7 @@ func NewRestorePointsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreate - The operation to create the restore point. Updating properties of an existing restore point is not allowed // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - restorePointCollectionName - The name of the restore point collection. // - restorePointName - The name of the restore point. @@ -70,7 +70,7 @@ func (client *RestorePointsClient) BeginCreate(ctx context.Context, resourceGrou // Create - The operation to create the restore point. Updating properties of an existing restore point is not allowed // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *RestorePointsClient) create(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "RestorePointsClient.BeginCreate" @@ -116,7 +116,7 @@ func (client *RestorePointsClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -128,7 +128,7 @@ func (client *RestorePointsClient) createCreateRequest(ctx context.Context, reso // BeginDelete - The operation to delete the restore point. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - restorePointCollectionName - The name of the Restore Point Collection. // - restorePointName - The name of the restore point. @@ -150,7 +150,7 @@ func (client *RestorePointsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - The operation to delete the restore point. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *RestorePointsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RestorePointsClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, reso // Get - The operation to get the restore point. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - restorePointCollectionName - The name of the restore point collection. // - restorePointName - The name of the restore point. @@ -259,7 +259,7 @@ func (client *RestorePointsClient) getCreateRequest(ctx context.Context, resourc if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 6680c3c73f55..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/restorePointExamples/RestorePoint_Delete_MaximumSet_Gen.json -func ExampleRestorePointsClient_BeginDelete_restorePointDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/restorePointExamples/RestorePoint_Delete_MinimumSet_Gen.json -func ExampleRestorePointsClient_BeginDelete_restorePointDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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.DiskRestorePointAttributes{ - // 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.DiskRestorePointAttributes{ - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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.DiskRestorePointAttributes{ - // 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.DiskRestorePointAttributes{ - // 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/sharedgalleries_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go deleted file mode 100644 index 9edcd7efdd87..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go deleted file mode 100644 index 8598fed96057..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go deleted file mode 100644 index 2d613938b4a5..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/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/snapshots_client_example_test.go b/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go deleted file mode 100644 index 061728cdfe37..000000000000 --- a/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go +++ /dev/null @@ -1,746 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-02/examples/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnElasticSanVolumeSnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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", "mySnapshot", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot), - SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed 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"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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), - FileFormat: to.Ptr(armcompute.FileFormatVHDX), - }, nil) - if err != nil { - log.Fatalf("failed 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2023-04-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/sshpublickeys_client.go b/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go index aaeadea53b3e..7ce104a119d0 100644 --- a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go +++ b/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go @@ -47,7 +47,7 @@ func NewSSHPublicKeysClient(subscriptionID string, credential azcore.TokenCreden // Create - Creates a new SSH public key resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - sshPublicKeyName - The name of the SSH public key. // - parameters - Parameters supplied to create the SSH public key. @@ -94,7 +94,7 @@ func (client *SSHPublicKeysClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -115,7 +115,7 @@ func (client *SSHPublicKeysClient) createHandleResponse(resp *http.Response) (SS // Delete - Delete an SSH public key. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - sshPublicKeyName - The name of the SSH public key. // - options - SSHPublicKeysClientDeleteOptions contains the optional parameters for the SSHPublicKeysClient.Delete method. @@ -160,7 +160,7 @@ func (client *SSHPublicKeysClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,7 +171,7 @@ func (client *SSHPublicKeysClient) deleteCreateRequest(ctx context.Context, reso // SSH public key resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - sshPublicKeyName - The name of the SSH public key. // - options - SSHPublicKeysClientGenerateKeyPairOptions contains the optional parameters for the SSHPublicKeysClient.GenerateKeyPair @@ -218,7 +218,7 @@ func (client *SSHPublicKeysClient) generateKeyPairCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +236,7 @@ func (client *SSHPublicKeysClient) generateKeyPairHandleResponse(resp *http.Resp // Get - Retrieves information about an SSH public key. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - sshPublicKeyName - The name of the SSH public key. // - options - SSHPublicKeysClientGetOptions contains the optional parameters for the SSHPublicKeysClient.Get method. @@ -282,7 +282,7 @@ func (client *SSHPublicKeysClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,7 +300,7 @@ func (client *SSHPublicKeysClient) getHandleResponse(resp *http.Response) (SSHPu // NewListByResourceGroupPager - Lists all of the SSH public keys in the specified resource group. Use the nextLink property // in the response to get the next page of SSH public keys. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - options - SSHPublicKeysClientListByResourceGroupOptions contains the optional parameters for the SSHPublicKeysClient.NewListByResourceGroupPager // method. @@ -350,7 +350,7 @@ func (client *SSHPublicKeysClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -368,7 +368,7 @@ func (client *SSHPublicKeysClient) listByResourceGroupHandleResponse(resp *http. // NewListBySubscriptionPager - Lists all of the SSH public keys in the subscription. Use the nextLink property in the response // to get the next page of SSH public keys. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - options - SSHPublicKeysClientListBySubscriptionOptions contains the optional parameters for the SSHPublicKeysClient.NewListBySubscriptionPager // method. func (client *SSHPublicKeysClient) NewListBySubscriptionPager(options *SSHPublicKeysClientListBySubscriptionOptions) *runtime.Pager[SSHPublicKeysClientListBySubscriptionResponse] { @@ -413,7 +413,7 @@ func (client *SSHPublicKeysClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -431,7 +431,7 @@ func (client *SSHPublicKeysClient) listBySubscriptionHandleResponse(resp *http.R // Update - Updates a new SSH public key resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - sshPublicKeyName - The name of the SSH public key. // - parameters - Parameters supplied to update the SSH public key. @@ -478,7 +478,7 @@ func (client *SSHPublicKeysClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 c4c41733f7a6..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go +++ /dev/null @@ -1,351 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeyListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeyListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListByResourceGroupPager_sshPublicKeyListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListByResourceGroupPager_sshPublicKeyListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_Update_sshPublicKeyUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/sshPublicKeyExamples/SshPublicKey_Update_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_Update_sshPublicKeyUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/sshPublicKeyExamples/SshPublicKey_Delete_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_Delete_sshPublicKeyDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/sshPublicKeyExamples/SshPublicKey_Delete_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_Delete_sshPublicKeyDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/sshPublicKeyExamples/SshPublicKey_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.go b/sdk/resourcemanager/compute/armcompute/usage_client.go index 7ae6ad6e2c9c..16c2ff387a4a 100644 --- a/sdk/resourcemanager/compute/armcompute/usage_client.go +++ b/sdk/resourcemanager/compute/armcompute/usage_client.go @@ -47,7 +47,7 @@ func NewUsageClient(subscriptionID string, credential azcore.TokenCredential, op // NewListPager - Gets, for the specified location, the current compute resource usage information as well as the limits for // compute resources under the subscription. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The location for which resource usage is queried. // - options - UsageClientListOptions contains the optional parameters for the UsageClient.NewListPager method. func (client *UsageClient) NewListPager(location string, options *UsageClientListOptions) *runtime.Pager[UsageClientListResponse] { @@ -96,7 +96,7 @@ func (client *UsageClient) listCreateRequest(ctx context.Context, location strin return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 8c38593548d2..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/virtualmachineextensionimages_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go index b29d4a82271c..c52fc9344f2c 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go @@ -48,7 +48,7 @@ func NewVirtualMachineExtensionImagesClient(subscriptionID string, credential az // Get - Gets a virtual machine extension image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - options - VirtualMachineExtensionImagesClientGetOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.Get // method. @@ -102,7 +102,7 @@ func (client *VirtualMachineExtensionImagesClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -120,7 +120,7 @@ func (client *VirtualMachineExtensionImagesClient) getHandleResponse(resp *http. // ListTypes - Gets a list of virtual machine extension image types. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - options - VirtualMachineExtensionImagesClientListTypesOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.ListTypes // method. @@ -166,7 +166,7 @@ func (client *VirtualMachineExtensionImagesClient) listTypesCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,7 +184,7 @@ func (client *VirtualMachineExtensionImagesClient) listTypesHandleResponse(resp // ListVersions - Gets a list of virtual machine extension image versions. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - options - VirtualMachineExtensionImagesClientListVersionsOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.ListVersions // method. @@ -243,7 +243,7 @@ func (client *VirtualMachineExtensionImagesClient) listVersionsCreateRequest(ctx if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 b61b94a487dc..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go +++ /dev/null @@ -1,212 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_Get_virtualMachineExtensionImageGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_Get_virtualMachineExtensionImageGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListTypes_virtualMachineExtensionImageListTypesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListTypes_virtualMachineExtensionImageListTypesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListVersions_virtualMachineExtensionImageListVersionsMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListVersions_virtualMachineExtensionImageListVersionsMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // }} -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go index 2a6875dbee67..ce61bb296ecc 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go @@ -47,7 +47,7 @@ func NewVirtualMachineExtensionsClient(subscriptionID string, credential azcore. // BeginCreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine where the extension should be created or updated. // - vmExtensionName - The name of the virtual machine extension. @@ -70,7 +70,7 @@ func (client *VirtualMachineExtensionsClient) BeginCreateOrUpdate(ctx context.Co // CreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineExtensionsClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *VirtualMachineExtensionsClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { @@ -128,7 +128,7 @@ func (client *VirtualMachineExtensionsClient) createOrUpdateCreateRequest(ctx co // BeginDelete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine where the extension should be deleted. // - vmExtensionName - The name of the virtual machine extension. @@ -150,7 +150,7 @@ func (client *VirtualMachineExtensionsClient) BeginDelete(ctx context.Context, r // Delete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineExtensionsClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *VirtualMachineExtensionsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *VirtualMachineExtensionsClient) deleteCreateRequest(ctx context.Co // Get - The operation to get the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine containing the extension. // - vmExtensionName - The name of the virtual machine extension. @@ -260,7 +260,7 @@ func (client *VirtualMachineExtensionsClient) getCreateRequest(ctx context.Conte if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,7 +278,7 @@ func (client *VirtualMachineExtensionsClient) getHandleResponse(resp *http.Respo // List - The operation to get all extensions of a Virtual Machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine containing the extension. // - options - VirtualMachineExtensionsClientListOptions contains the optional parameters for the VirtualMachineExtensionsClient.List @@ -328,7 +328,7 @@ func (client *VirtualMachineExtensionsClient) listCreateRequest(ctx context.Cont if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -346,7 +346,7 @@ func (client *VirtualMachineExtensionsClient) listHandleResponse(resp *http.Resp // BeginUpdate - The operation to update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine where the extension should be updated. // - vmExtensionName - The name of the virtual machine extension. @@ -369,7 +369,7 @@ func (client *VirtualMachineExtensionsClient) BeginUpdate(ctx context.Context, r // Update - The operation to update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineExtensionsClient) update(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineExtensionsClient.BeginUpdate" @@ -415,7 +415,7 @@ func (client *VirtualMachineExtensionsClient) updateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { 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 8c91963bccf3..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go +++ /dev/null @@ -1,439 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate_virtualMachineExtensionCreateOrUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate_virtualMachineExtensionCreateOrUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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", "myVM", "myVMExtension", 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{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_Delete_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginDelete_virtualMachineExtensionDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_Delete_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginDelete_virtualMachineExtensionDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_Get_virtualMachineExtensionGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_Get_virtualMachineExtensionGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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", "myVM", "myVMExtension", &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{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_List_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_List_virtualMachineExtensionListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachineExtension_List_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_List_virtualMachineExtensionListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/virtualmachineimages_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go index 4929b4f6e3a5..7e4fc213d465 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go @@ -48,7 +48,7 @@ func NewVirtualMachineImagesClient(subscriptionID string, credential azcore.Toke // Get - Gets a virtual machine image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - publisherName - A valid image publisher. // - offer - A valid image publisher offer. @@ -110,7 +110,7 @@ func (client *VirtualMachineImagesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -128,7 +128,7 @@ func (client *VirtualMachineImagesClient) getHandleResponse(resp *http.Response) // List - Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - publisherName - A valid image publisher. // - offer - A valid image publisher offer. @@ -194,7 +194,7 @@ func (client *VirtualMachineImagesClient) listCreateRequest(ctx context.Context, if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +212,7 @@ func (client *VirtualMachineImagesClient) listHandleResponse(resp *http.Response // ListByEdgeZone - Gets a list of all virtual machine image versions for the specified edge zone // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - edgeZone - The name of the edge zone. // - options - VirtualMachineImagesClientListByEdgeZoneOptions contains the optional parameters for the VirtualMachineImagesClient.ListByEdgeZone @@ -259,7 +259,7 @@ func (client *VirtualMachineImagesClient) listByEdgeZoneCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -277,7 +277,7 @@ func (client *VirtualMachineImagesClient) listByEdgeZoneHandleResponse(resp *htt // ListOffers - Gets a list of virtual machine image offers for the specified location and publisher. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - publisherName - A valid image publisher. // - options - VirtualMachineImagesClientListOffersOptions contains the optional parameters for the VirtualMachineImagesClient.ListOffers @@ -324,7 +324,7 @@ func (client *VirtualMachineImagesClient) listOffersCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,7 +342,7 @@ func (client *VirtualMachineImagesClient) listOffersHandleResponse(resp *http.Re // ListPublishers - Gets a list of virtual machine image publishers for the specified Azure location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - options - VirtualMachineImagesClientListPublishersOptions contains the optional parameters for the VirtualMachineImagesClient.ListPublishers // method. @@ -384,7 +384,7 @@ func (client *VirtualMachineImagesClient) listPublishersCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -402,7 +402,7 @@ func (client *VirtualMachineImagesClient) listPublishersHandleResponse(resp *htt // ListSKUs - Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - publisherName - A valid image publisher. // - offer - A valid image publisher offer. @@ -454,7 +454,7 @@ func (client *VirtualMachineImagesClient) listSKUsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 d204db0cdb3a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go +++ /dev/null @@ -1,408 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineImageExamples/VirtualMachineImage_Get_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_Get_virtualMachineImageGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineImageExamples/VirtualMachineImage_Get_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_Get_virtualMachineImageGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaa"), - // Location: to.Ptr("aaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineImageExamples/VirtualMachineImage_List_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_List_virtualMachineImageListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineImageExamples/VirtualMachineImage_List_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_List_virtualMachineImageListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListOffers_virtualMachineImageListOffersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListOffers_virtualMachineImageListOffersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListPublishers_virtualMachineImageListPublishersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListPublishers_virtualMachineImageListPublishersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListSKUs_virtualMachineImageListSkusMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListSKUs_virtualMachineImageListSkusMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go index f985a9c20215..2399eb6c111d 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go @@ -48,7 +48,7 @@ func NewVirtualMachineImagesEdgeZoneClient(subscriptionID string, credential azc // Get - Gets a virtual machine image in an edge zone. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - edgeZone - The name of the edge zone. // - publisherName - A valid image publisher. @@ -115,7 +115,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -133,7 +133,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) getHandleResponse(resp *http.R // List - Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - edgeZone - The name of the edge zone. // - publisherName - A valid image publisher. @@ -204,7 +204,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listCreateRequest(ctx context. if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -222,7 +222,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listHandleResponse(resp *http. // ListOffers - Gets a list of virtual machine image offers for the specified location, edge zone and publisher. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - edgeZone - The name of the edge zone. // - publisherName - A valid image publisher. @@ -274,7 +274,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listOffersCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -292,7 +292,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listOffersHandleResponse(resp // ListPublishers - Gets a list of virtual machine image publishers for the specified Azure location and edge zone. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - edgeZone - The name of the edge zone. // - options - VirtualMachineImagesEdgeZoneClientListPublishersOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.ListPublishers @@ -339,7 +339,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listPublishersCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -357,7 +357,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listPublishersHandleResponse(r // ListSKUs - Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The name of a supported Azure region. // - edgeZone - The name of the edge zone. // - publisherName - A valid image publisher. @@ -414,7 +414,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listSKUsCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 a5da583bfeb7..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go +++ /dev/null @@ -1,344 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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{ - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaa"), - // Location: to.Ptr("aaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go index cd54dc29bc9a..7def7c82c43f 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go @@ -47,7 +47,7 @@ func NewVirtualMachineRunCommandsClient(subscriptionID string, credential azcore // BeginCreateOrUpdate - The operation to create or update the run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine where the run command should be created or updated. // - runCommandName - The name of the virtual machine run command. @@ -70,7 +70,7 @@ func (client *VirtualMachineRunCommandsClient) BeginCreateOrUpdate(ctx context.C // CreateOrUpdate - The operation to create or update the run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineRunCommandsClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *VirtualMachineRunCommandsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} if err := runtime.MarshalAsJSON(req, runCommand); err != nil { @@ -128,7 +128,7 @@ func (client *VirtualMachineRunCommandsClient) createOrUpdateCreateRequest(ctx c // BeginDelete - The operation to delete the run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine where the run command should be deleted. // - runCommandName - The name of the virtual machine run command. @@ -150,7 +150,7 @@ func (client *VirtualMachineRunCommandsClient) BeginDelete(ctx context.Context, // Delete - The operation to delete the run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineRunCommandsClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *VirtualMachineRunCommandsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -205,7 +205,7 @@ func (client *VirtualMachineRunCommandsClient) deleteCreateRequest(ctx context.C // Get - Gets specific run command for a subscription in a location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The location upon which run commands is queried. // - commandID - The command id. // - options - VirtualMachineRunCommandsClientGetOptions contains the optional parameters for the VirtualMachineRunCommandsClient.Get @@ -252,7 +252,7 @@ func (client *VirtualMachineRunCommandsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -270,7 +270,7 @@ func (client *VirtualMachineRunCommandsClient) getHandleResponse(resp *http.Resp // GetByVirtualMachine - The operation to get the run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine containing the run command. // - runCommandName - The name of the virtual machine run command. @@ -325,7 +325,7 @@ func (client *VirtualMachineRunCommandsClient) getByVirtualMachineCreateRequest( if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -342,7 +342,7 @@ func (client *VirtualMachineRunCommandsClient) getByVirtualMachineHandleResponse // NewListPager - Lists all available run commands for a subscription in a location. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The location upon which run commands is queried. // - options - VirtualMachineRunCommandsClientListOptions contains the optional parameters for the VirtualMachineRunCommandsClient.NewListPager // method. @@ -392,7 +392,7 @@ func (client *VirtualMachineRunCommandsClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -409,7 +409,7 @@ func (client *VirtualMachineRunCommandsClient) listHandleResponse(resp *http.Res // NewListByVirtualMachinePager - The operation to get all run commands of a Virtual Machine. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine containing the run command. // - options - VirtualMachineRunCommandsClientListByVirtualMachineOptions contains the optional parameters for the VirtualMachineRunCommandsClient.NewListByVirtualMachinePager @@ -467,7 +467,7 @@ func (client *VirtualMachineRunCommandsClient) listByVirtualMachineCreateRequest if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -485,7 +485,7 @@ func (client *VirtualMachineRunCommandsClient) listByVirtualMachineHandleRespons // BeginUpdate - The operation to update the run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine where the run command should be updated. // - runCommandName - The name of the virtual machine run command. @@ -508,7 +508,7 @@ func (client *VirtualMachineRunCommandsClient) BeginUpdate(ctx context.Context, // Update - The operation to update the run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineRunCommandsClient.BeginUpdate" @@ -554,7 +554,7 @@ func (client *VirtualMachineRunCommandsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} if err := runtime.MarshalAsJSON(req, runCommand); err != nil { 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 f5ca50c8e52b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go +++ /dev/null @@ -1,452 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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), - ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI"), - OutputBlobManagedIdentity: &armcompute.RunCommandManagedIdentity{ - ClientID: to.Ptr("22d35efb-0c99-4041-8c5b-6d24db33a69a"), - }, - OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - 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{ - ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI"), - }, - TimeoutInSeconds: to.Ptr[int32](3600), - TreatFailureAsDeploymentFailure: 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.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), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // 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{ - // ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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{ - AsyncExecution: to.Ptr(false), - ErrorBlobManagedIdentity: &armcompute.RunCommandManagedIdentity{ - ObjectID: to.Ptr("4231e4d2-33e4-4e23-96b2-17888afa6072"), - }, - ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/outputUri"), - 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! ; Remove-Item C: est estFile.txt"), - }, - 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), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // 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! ; Remove-Item C: est estFile.txt"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // 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! ; Remove-Item C: est estFile.txt"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // 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), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go index d06fb207a40e..f9379aca79d8 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go @@ -48,7 +48,7 @@ func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCred // BeginAssessPatches - Assess patches on the VM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginAssessPatchesOptions contains the optional parameters for the VirtualMachinesClient.BeginAssessPatches @@ -71,7 +71,7 @@ func (client *VirtualMachinesClient) BeginAssessPatches(ctx context.Context, res // AssessPatches - Assess patches on the VM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) assessPatches(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginAssessPatches" @@ -113,7 +113,7 @@ func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,7 +123,7 @@ func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Cont // similar VMs. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - parameters - Parameters supplied to the Capture Virtual Machine operation. @@ -148,7 +148,7 @@ func (client *VirtualMachinesClient) BeginCapture(ctx context.Context, resourceG // VMs. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) capture(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesClientBeginCaptureOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginCapture" @@ -190,7 +190,7 @@ func (client *VirtualMachinesClient) captureCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -203,7 +203,7 @@ func (client *VirtualMachinesClient) captureCreateRequest(ctx context.Context, r // before invoking this operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginConvertToManagedDisksOptions contains the optional parameters for the VirtualMachinesClient.BeginConvertToManagedDisks @@ -225,7 +225,7 @@ func (client *VirtualMachinesClient) BeginConvertToManagedDisks(ctx context.Cont // before invoking this operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) convertToManagedDisks(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginConvertToManagedDisksOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginConvertToManagedDisks" @@ -267,7 +267,7 @@ func (client *VirtualMachinesClient) convertToManagedDisksCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -277,7 +277,7 @@ func (client *VirtualMachinesClient) convertToManagedDisksCreateRequest(ctx cont // during virtual machine creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - parameters - Parameters supplied to the Create Virtual Machine operation. @@ -300,7 +300,7 @@ func (client *VirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, re // virtual machine creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginCreateOrUpdate" @@ -342,7 +342,7 @@ func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -355,7 +355,7 @@ func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Con // resources that this virtual machine uses. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginDeallocateOptions contains the optional parameters for the VirtualMachinesClient.BeginDeallocate @@ -377,7 +377,7 @@ func (client *VirtualMachinesClient) BeginDeallocate(ctx context.Context, resour // that this virtual machine uses. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) deallocate(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeallocateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginDeallocate" @@ -422,7 +422,7 @@ func (client *VirtualMachinesClient) deallocateCreateRequest(ctx context.Context if options != nil && options.Hibernate != nil { reqQP.Set("hibernate", strconv.FormatBool(*options.Hibernate)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -431,7 +431,7 @@ func (client *VirtualMachinesClient) deallocateCreateRequest(ctx context.Context // BeginDelete - The operation to delete a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginDeleteOptions contains the optional parameters for the VirtualMachinesClient.BeginDelete @@ -452,7 +452,7 @@ func (client *VirtualMachinesClient) BeginDelete(ctx context.Context, resourceGr // Delete - The operation to delete a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginDelete" @@ -497,7 +497,7 @@ func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, re if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -510,7 +510,7 @@ func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, re // [https://docs.microsoft.com/azure/virtual-machines/linux/capture-image]. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientGeneralizeOptions contains the optional parameters for the VirtualMachinesClient.Generalize @@ -556,7 +556,7 @@ func (client *VirtualMachinesClient) generalizeCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -565,7 +565,7 @@ func (client *VirtualMachinesClient) generalizeCreateRequest(ctx context.Context // Get - Retrieves information about the model view or the instance view of a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. @@ -614,7 +614,7 @@ func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resou if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -632,7 +632,7 @@ func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (Vir // BeginInstallPatches - Installs patches on the VM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - installPatchesInput - Input for InstallPatches as directly received by the API @@ -656,7 +656,7 @@ func (client *VirtualMachinesClient) BeginInstallPatches(ctx context.Context, re // InstallPatches - Installs patches on the VM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) installPatches(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginInstallPatches" @@ -698,7 +698,7 @@ func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, installPatchesInput); err != nil { @@ -710,7 +710,7 @@ func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Con // InstanceView - Retrieves information about the run-time state of a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientInstanceViewOptions contains the optional parameters for the VirtualMachinesClient.InstanceView @@ -757,7 +757,7 @@ func (client *VirtualMachinesClient) instanceViewCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -775,7 +775,7 @@ func (client *VirtualMachinesClient) instanceViewHandleResponse(resp *http.Respo // NewListPager - Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response // to get the next page of virtual machines. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - options - VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.NewListPager // method. @@ -831,7 +831,7 @@ func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, reso if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -849,7 +849,7 @@ func (client *VirtualMachinesClient) listHandleResponse(resp *http.Response) (Vi // NewListAllPager - Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response // to get the next page of virtual machines. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - options - VirtualMachinesClientListAllOptions contains the optional parameters for the VirtualMachinesClient.NewListAllPager // method. func (client *VirtualMachinesClient) NewListAllPager(options *VirtualMachinesClientListAllOptions) *runtime.Pager[VirtualMachinesClientListAllResponse] { @@ -894,7 +894,7 @@ func (client *VirtualMachinesClient) listAllCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") if options != nil && options.StatusOnly != nil { reqQP.Set("statusOnly", *options.StatusOnly) } @@ -920,7 +920,7 @@ func (client *VirtualMachinesClient) listAllHandleResponse(resp *http.Response) // NewListAvailableSizesPager - Lists all available virtual machine sizes to which the specified virtual machine can be resized. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientListAvailableSizesOptions contains the optional parameters for the VirtualMachinesClient.NewListAvailableSizesPager @@ -969,7 +969,7 @@ func (client *VirtualMachinesClient) listAvailableSizesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -986,7 +986,7 @@ func (client *VirtualMachinesClient) listAvailableSizesHandleResponse(resp *http // NewListByLocationPager - Gets all the virtual machines under the specified subscription for the specified location. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The location for which virtual machines under the subscription are queried. // - options - VirtualMachinesClientListByLocationOptions contains the optional parameters for the VirtualMachinesClient.NewListByLocationPager // method. @@ -1036,7 +1036,7 @@ func (client *VirtualMachinesClient) listByLocationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1054,7 +1054,7 @@ func (client *VirtualMachinesClient) listByLocationHandleResponse(resp *http.Res // BeginPerformMaintenance - The operation to perform maintenance on a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginPerformMaintenanceOptions contains the optional parameters for the VirtualMachinesClient.BeginPerformMaintenance @@ -1075,7 +1075,7 @@ func (client *VirtualMachinesClient) BeginPerformMaintenance(ctx context.Context // PerformMaintenance - The operation to perform maintenance on a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) performMaintenance(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPerformMaintenanceOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginPerformMaintenance" @@ -1117,7 +1117,7 @@ func (client *VirtualMachinesClient) performMaintenanceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1127,7 +1127,7 @@ func (client *VirtualMachinesClient) performMaintenanceCreateRequest(ctx context // provisioned resources. You are still charged for this virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginPowerOffOptions contains the optional parameters for the VirtualMachinesClient.BeginPowerOff @@ -1149,7 +1149,7 @@ func (client *VirtualMachinesClient) BeginPowerOff(ctx context.Context, resource // resources. You are still charged for this virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) powerOff(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPowerOffOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginPowerOff" @@ -1194,7 +1194,7 @@ func (client *VirtualMachinesClient) powerOffCreateRequest(ctx context.Context, if options != nil && options.SkipShutdown != nil { reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1203,7 +1203,7 @@ func (client *VirtualMachinesClient) powerOffCreateRequest(ctx context.Context, // BeginReapply - The operation to reapply a virtual machine's state. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginReapplyOptions contains the optional parameters for the VirtualMachinesClient.BeginReapply @@ -1224,7 +1224,7 @@ func (client *VirtualMachinesClient) BeginReapply(ctx context.Context, resourceG // Reapply - The operation to reapply a virtual machine's state. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) reapply(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReapplyOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginReapply" @@ -1266,7 +1266,7 @@ func (client *VirtualMachinesClient) reapplyCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1275,7 +1275,7 @@ func (client *VirtualMachinesClient) reapplyCreateRequest(ctx context.Context, r // BeginRedeploy - Shuts down the virtual machine, moves it to a new node, and powers it back on. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginRedeployOptions contains the optional parameters for the VirtualMachinesClient.BeginRedeploy @@ -1296,7 +1296,7 @@ func (client *VirtualMachinesClient) BeginRedeploy(ctx context.Context, resource // Redeploy - Shuts down the virtual machine, moves it to a new node, and powers it back on. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRedeployOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginRedeploy" @@ -1338,7 +1338,7 @@ func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1351,7 +1351,7 @@ func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, // will be deleted after reimage. The deleteOption of the OS disk should be updated accordingly before performing the reimage. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginReimageOptions contains the optional parameters for the VirtualMachinesClient.BeginReimage @@ -1376,7 +1376,7 @@ func (client *VirtualMachinesClient) BeginReimage(ctx context.Context, resourceG // will be deleted after reimage. The deleteOption of the OS disk should be updated accordingly before performing the reimage. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) reimage(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReimageOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginReimage" @@ -1418,7 +1418,7 @@ func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { @@ -1433,7 +1433,7 @@ func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, r // BeginRestart - The operation to restart a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginRestartOptions contains the optional parameters for the VirtualMachinesClient.BeginRestart @@ -1454,7 +1454,7 @@ func (client *VirtualMachinesClient) BeginRestart(ctx context.Context, resourceG // Restart - The operation to restart a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) restart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginRestart" @@ -1496,7 +1496,7 @@ func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1505,7 +1505,7 @@ func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, r // RetrieveBootDiagnosticsData - The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientRetrieveBootDiagnosticsDataOptions contains the optional parameters for the VirtualMachinesClient.RetrieveBootDiagnosticsData @@ -1555,7 +1555,7 @@ func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataCreateRequest(ct if options != nil && options.SasURIExpirationTimeInMinutes != nil { reqQP.Set("sasUriExpirationTimeInMinutes", strconv.FormatInt(int64(*options.SasURIExpirationTimeInMinutes), 10)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1573,7 +1573,7 @@ func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataHandleResponse(r // BeginRunCommand - Run command on the VM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - parameters - Parameters supplied to the Run command operation. @@ -1597,7 +1597,7 @@ func (client *VirtualMachinesClient) BeginRunCommand(ctx context.Context, resour // RunCommand - Run command on the VM. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) runCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesClientBeginRunCommandOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginRunCommand" @@ -1639,7 +1639,7 @@ func (client *VirtualMachinesClient) runCommandCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -1651,7 +1651,7 @@ func (client *VirtualMachinesClient) runCommandCreateRequest(ctx context.Context // SimulateEviction - The operation to simulate the eviction of spot virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientSimulateEvictionOptions contains the optional parameters for the VirtualMachinesClient.SimulateEviction @@ -1697,7 +1697,7 @@ func (client *VirtualMachinesClient) simulateEvictionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1706,7 +1706,7 @@ func (client *VirtualMachinesClient) simulateEvictionCreateRequest(ctx context.C // BeginStart - The operation to start a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - options - VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart @@ -1727,7 +1727,7 @@ func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGro // Start - The operation to start a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginStart" @@ -1769,7 +1769,7 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1778,7 +1778,7 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res // BeginUpdate - The operation to update a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - parameters - Parameters supplied to the Update Virtual Machine operation. @@ -1800,7 +1800,7 @@ func (client *VirtualMachinesClient) BeginUpdate(ctx context.Context, resourceGr // Update - The operation to update a virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachinesClient) update(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginUpdate" @@ -1842,7 +1842,7 @@ func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 a1f8ee6370a2..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go +++ /dev/null @@ -1,9049 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Capture_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginCapture_virtualMachineCaptureMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Capture_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginCapture_virtualMachineCaptureMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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{ - BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), - 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{ - // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(true), - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Create_WithVMSizeProperties.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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfigurationDnsSettings.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithNetworkInterfaceConfigurationWithPublicIpAddressDnsSettings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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), - DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - DomainNameLabel: to.Ptr("aaaaa"), - DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesTenantReuse), - }, - 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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{ - BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(false), - 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{ - // BypassPlatformSafetyChecksOnUserSchedule: to.Ptr(false), - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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, "2023-07-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, "2023-07-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, "2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginConvertToManagedDisks_virtualMachineConvertToManagedDisksMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginConvertToManagedDisks_virtualMachineConvertToManagedDisksMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginDeallocate_virtualMachineDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginDeallocate_virtualMachineDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_List_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_NewListPager_virtualMachineListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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"), - 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.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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_List_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_NewListPager_virtualMachineListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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, - 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.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_ListAll_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_NewListAllPager_virtualMachineListAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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"), - 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.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"), - // DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesTenantReuse), - // }, - // 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"), - // 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}"), - // }, - // 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"), - // DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesSubscriptionReuse), - // }, - // 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"), - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_ListAll_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_NewListAllPager_virtualMachineListAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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, - 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.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPowerOff_virtualMachinePowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPowerOff_virtualMachinePowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Restart_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRestart_virtualMachineRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Restart_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRestart_virtualMachineRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Start_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginStart_virtualMachineStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Start_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginStart_virtualMachineStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRedeploy_virtualMachineRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRedeploy_virtualMachineRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPerformMaintenance_virtualMachinePerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineExamples/VirtualMachine_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPerformMaintenance_virtualMachinePerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/virtualmachinescalesetextensions_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go index 273bca770dcf..95a0301cb8b7 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go @@ -47,7 +47,7 @@ func NewVirtualMachineScaleSetExtensionsClient(subscriptionID string, credential // BeginCreateOrUpdate - The operation to create or update an extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set where the extension should be create or updated. // - vmssExtensionName - The name of the VM scale set extension. @@ -70,7 +70,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) BeginCreateOrUpdate(ctx co // CreateOrUpdate - The operation to create or update an extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetExtensionsClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { @@ -128,7 +128,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateCreateReques // BeginDelete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set where the extension should be deleted. // - vmssExtensionName - The name of the VM scale set extension. @@ -150,7 +150,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) BeginDelete(ctx context.Co // Delete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetExtensionsClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) deleteCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) deleteCreateRequest(ctx co // Get - The operation to get the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set containing the extension. // - vmssExtensionName - The name of the VM scale set extension. @@ -260,7 +260,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) getCreateRequest(ctx conte if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -277,7 +277,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) getHandleResponse(resp *ht // NewListPager - Gets a list of all extensions in a VM scale set. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set containing the extension. // - options - VirtualMachineScaleSetExtensionsClientListOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.NewListPager @@ -332,7 +332,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) listCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -350,7 +350,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) listHandleResponse(resp *h // BeginUpdate - The operation to update an extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set where the extension should be updated. // - vmssExtensionName - The name of the VM scale set extension. @@ -373,7 +373,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) BeginUpdate(ctx context.Co // Update - The operation to update an extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetExtensionsClient.BeginUpdate" @@ -419,7 +419,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) updateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { 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 42b61dfca377..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginCreateOrUpdate_virtualMachineScaleSetExtensionCreateOrUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginCreateOrUpdate_virtualMachineScaleSetExtensionCreateOrUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginUpdate_virtualMachineScaleSetExtensionUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginUpdate_virtualMachineScaleSetExtensionUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginDelete_virtualMachineScaleSetExtensionDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginDelete_virtualMachineScaleSetExtensionDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_Get_virtualMachineScaleSetExtensionGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_Get_virtualMachineScaleSetExtensionGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_NewListPager_virtualMachineScaleSetExtensionListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_NewListPager_virtualMachineScaleSetExtensionListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go index bf3025503d8f..8f48610c36a3 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go @@ -47,7 +47,7 @@ func NewVirtualMachineScaleSetRollingUpgradesClient(subscriptionID string, crede // BeginCancel - Cancels the current virtual machine scale set rolling upgrade. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions contains the optional parameters for the VirtualMachineScaleSetRollingUpgradesClient.BeginCancel @@ -68,7 +68,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginCancel(ctx conte // Cancel - Cancels the current virtual machine scale set rolling upgrade. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetRollingUpgradesClient) cancel(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetRollingUpgradesClient.BeginCancel" @@ -110,7 +110,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,7 +119,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelCreateRequest(c // GetLatest - Gets the status of the latest virtual machine scale set rolling upgrade. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetRollingUpgradesClientGetLatestOptions contains the optional parameters for the VirtualMachineScaleSetRollingUpgradesClient.GetLatest @@ -166,7 +166,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -186,7 +186,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestHandleRespon // are not affected. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions contains the optional parameters @@ -209,7 +209,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartExtensionUp // are not affected. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetRollingUpgradesClient.BeginStartExtensionUpgrade" @@ -251,7 +251,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +262,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade // affected. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions contains the optional parameters for the @@ -285,7 +285,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartOSUpgrade(c // affected. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetRollingUpgradesClient.BeginStartOSUpgrade" @@ -327,7 +327,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgradeCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 71be6ef5c43b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client_example_test.go +++ /dev/null @@ -1,215 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginCancel_virtualMachineScaleSetRollingUpgradeCancelMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginCancel_virtualMachineScaleSetRollingUpgradeCancelMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartOSUpgrade_virtualMachineScaleSetRollingUpgradeStartOsUpgradeMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartOSUpgrade_virtualMachineScaleSetRollingUpgradeStartOsUpgradeMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_GetLatest_virtualMachineScaleSetRollingUpgradeGetLatestMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_GetLatest_virtualMachineScaleSetRollingUpgradeGetLatestMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // ID: to.Ptr("aaaaaaaaaa"), - // Location: to.Ptr("aaaaaa"), - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go index 9b457a5f2d16..930423559301 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go @@ -45,10 +45,90 @@ func NewVirtualMachineScaleSetsClient(subscriptionID string, credential azcore.T return client, nil } +// BeginApproveRollingUpgrade - Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM +// scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01 +// - resourceGroupName - The name of the resource group. +// - vmScaleSetName - The name of the VM scale set. +// - options - VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginApproveRollingUpgrade +// method. +func (client *VirtualMachineScaleSetsClient) BeginApproveRollingUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions) (*runtime.Poller[VirtualMachineScaleSetsClientApproveRollingUpgradeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.approveRollingUpgrade(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[VirtualMachineScaleSetsClientApproveRollingUpgradeResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientApproveRollingUpgradeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// ApproveRollingUpgrade - Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale +// set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01 +func (client *VirtualMachineScaleSetsClient) approveRollingUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetsClient.BeginApproveRollingUpgrade" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.approveRollingUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// approveRollingUpgradeCreateRequest creates the ApproveRollingUpgrade request. +func (client *VirtualMachineScaleSetsClient) approveRollingUpgradeCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginApproveRollingUpgradeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/approveRollingUpgrade" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + if err := runtime.MarshalAsJSON(req, *options.VMInstanceIDs); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + // ConvertToSinglePlacementGroup - Converts SinglePlacementGroup property to false for a existing virtual machine scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the virtual machine scale set to create or update. // - parameters - The input object for ConvertToSinglePlacementGroup API. @@ -95,7 +175,7 @@ func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupCreate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -107,7 +187,7 @@ func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupCreate // BeginCreateOrUpdate - Create or update a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set to create or update. // - parameters - The scale set object. @@ -129,7 +209,7 @@ func (client *VirtualMachineScaleSetsClient) BeginCreateOrUpdate(ctx context.Con // CreateOrUpdate - Create or update a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginCreateOrUpdate" @@ -171,7 +251,7 @@ func (client *VirtualMachineScaleSetsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -185,7 +265,7 @@ func (client *VirtualMachineScaleSetsClient) createOrUpdateCreateRequest(ctx con // scale set deallocates. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientBeginDeallocateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDeallocate @@ -208,7 +288,7 @@ func (client *VirtualMachineScaleSetsClient) BeginDeallocate(ctx context.Context // scale set deallocates. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeallocateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginDeallocate" @@ -253,7 +333,7 @@ func (client *VirtualMachineScaleSetsClient) deallocateCreateRequest(ctx context if options != nil && options.Hibernate != nil { reqQP.Set("hibernate", strconv.FormatBool(*options.Hibernate)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -268,7 +348,7 @@ func (client *VirtualMachineScaleSetsClient) deallocateCreateRequest(ctx context // BeginDelete - Deletes a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDelete @@ -289,7 +369,7 @@ func (client *VirtualMachineScaleSetsClient) BeginDelete(ctx context.Context, re // Delete - Deletes a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginDelete" @@ -334,7 +414,7 @@ func (client *VirtualMachineScaleSetsClient) deleteCreateRequest(ctx context.Con if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -343,7 +423,7 @@ func (client *VirtualMachineScaleSetsClient) deleteCreateRequest(ctx context.Con // BeginDeleteInstances - Deletes virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - vmInstanceIDs - A list of virtual machine instance IDs from the VM scale set. @@ -365,7 +445,7 @@ func (client *VirtualMachineScaleSetsClient) BeginDeleteInstances(ctx context.Co // DeleteInstances - Deletes virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) deleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginDeleteInstancesOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginDeleteInstances" @@ -410,7 +490,7 @@ func (client *VirtualMachineScaleSetsClient) deleteInstancesCreateRequest(ctx co if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, vmInstanceIDs); err != nil { @@ -423,7 +503,7 @@ func (client *VirtualMachineScaleSetsClient) deleteInstancesCreateRequest(ctx co // service fabric virtual machine scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - platformUpdateDomain - The platform update domain for which a manual recovery walk is requested @@ -471,7 +551,7 @@ func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformU return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") reqQP.Set("platformUpdateDomain", strconv.FormatInt(int64(platformUpdateDomain), 10)) if options != nil && options.Zone != nil { reqQP.Set("zone", *options.Zone) @@ -496,7 +576,7 @@ func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformU // Get - Display information about a virtual machine scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetsClient.Get @@ -543,7 +623,7 @@ func (client *VirtualMachineScaleSetsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -564,7 +644,7 @@ func (client *VirtualMachineScaleSetsClient) getHandleResponse(resp *http.Respon // GetInstanceView - Gets the status of a VM scale set instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientGetInstanceViewOptions contains the optional parameters for the VirtualMachineScaleSetsClient.GetInstanceView @@ -611,7 +691,7 @@ func (client *VirtualMachineScaleSetsClient) getInstanceViewCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -628,7 +708,7 @@ func (client *VirtualMachineScaleSetsClient) getInstanceViewHandleResponse(resp // NewGetOSUpgradeHistoryPager - Gets list of OS upgrades on a VM scale set instance. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientGetOSUpgradeHistoryOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewGetOSUpgradeHistoryPager @@ -683,7 +763,7 @@ func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -700,7 +780,7 @@ func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryHandleResponse(r // NewListPager - Gets a list of all VM scale sets under a resource group. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - options - VirtualMachineScaleSetsClientListOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListPager // method. @@ -750,7 +830,7 @@ func (client *VirtualMachineScaleSetsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -769,7 +849,7 @@ func (client *VirtualMachineScaleSetsClient) listHandleResponse(resp *http.Respo // nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is // null to fetch all the VM Scale Sets. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - options - VirtualMachineScaleSetsClientListAllOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListAllPager // method. func (client *VirtualMachineScaleSetsClient) NewListAllPager(options *VirtualMachineScaleSetsClientListAllOptions) *runtime.Pager[VirtualMachineScaleSetsClientListAllResponse] { @@ -814,7 +894,7 @@ func (client *VirtualMachineScaleSetsClient) listAllCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -831,7 +911,7 @@ func (client *VirtualMachineScaleSetsClient) listAllHandleResponse(resp *http.Re // NewListByLocationPager - Gets all the VM scale sets under the specified subscription for the specified location. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The location for which VM scale sets under the subscription are queried. // - options - VirtualMachineScaleSetsClientListByLocationOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListByLocationPager // method. @@ -881,7 +961,7 @@ func (client *VirtualMachineScaleSetsClient) listByLocationCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -899,7 +979,7 @@ func (client *VirtualMachineScaleSetsClient) listByLocationHandleResponse(resp * // NewListSKUsPager - Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances // allowed for each SKU. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientListSKUsOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListSKUsPager @@ -954,7 +1034,7 @@ func (client *VirtualMachineScaleSetsClient) listSKUsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -974,7 +1054,7 @@ func (client *VirtualMachineScaleSetsClient) listSKUsHandleResponse(resp *http.R // details: https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginPerformMaintenance @@ -997,7 +1077,7 @@ func (client *VirtualMachineScaleSetsClient) BeginPerformMaintenance(ctx context // details: https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginPerformMaintenance" @@ -1039,7 +1119,7 @@ func (client *VirtualMachineScaleSetsClient) performMaintenanceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1056,7 +1136,7 @@ func (client *VirtualMachineScaleSetsClient) performMaintenanceCreateRequest(ctx // avoid charges. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientBeginPowerOffOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginPowerOff @@ -1079,7 +1159,7 @@ func (client *VirtualMachineScaleSetsClient) BeginPowerOff(ctx context.Context, // avoid charges. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPowerOffOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginPowerOff" @@ -1124,7 +1204,7 @@ func (client *VirtualMachineScaleSetsClient) powerOffCreateRequest(ctx context.C if options != nil && options.SkipShutdown != nil { reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1139,7 +1219,7 @@ func (client *VirtualMachineScaleSetsClient) powerOffCreateRequest(ctx context.C // BeginReapply - Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientBeginReapplyOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReapply @@ -1162,7 +1242,7 @@ func (client *VirtualMachineScaleSetsClient) BeginReapply(ctx context.Context, r // Reapply - Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) reapply(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReapplyOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginReapply" @@ -1204,7 +1284,7 @@ func (client *VirtualMachineScaleSetsClient) reapplyCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1214,7 +1294,7 @@ func (client *VirtualMachineScaleSetsClient) reapplyCreateRequest(ctx context.Co // them back on. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientBeginRedeployOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginRedeploy @@ -1236,7 +1316,7 @@ func (client *VirtualMachineScaleSetsClient) BeginRedeploy(ctx context.Context, // back on. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRedeployOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginRedeploy" @@ -1278,7 +1358,7 @@ func (client *VirtualMachineScaleSetsClient) redeployCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1295,7 +1375,7 @@ func (client *VirtualMachineScaleSetsClient) redeployCreateRequest(ctx context.C // reset to initial state. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientBeginReimageOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReimage @@ -1318,7 +1398,7 @@ func (client *VirtualMachineScaleSetsClient) BeginReimage(ctx context.Context, r // reset to initial state. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginReimage" @@ -1360,7 +1440,7 @@ func (client *VirtualMachineScaleSetsClient) reimageCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMScaleSetReimageInput != nil { @@ -1376,7 +1456,7 @@ func (client *VirtualMachineScaleSetsClient) reimageCreateRequest(ctx context.Co // is only supported for managed disks. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientBeginReimageAllOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReimageAll @@ -1398,7 +1478,7 @@ func (client *VirtualMachineScaleSetsClient) BeginReimageAll(ctx context.Context // is only supported for managed disks. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageAllOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginReimageAll" @@ -1440,7 +1520,7 @@ func (client *VirtualMachineScaleSetsClient) reimageAllCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1455,7 +1535,7 @@ func (client *VirtualMachineScaleSetsClient) reimageAllCreateRequest(ctx context // BeginRestart - Restarts one or more virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientBeginRestartOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginRestart @@ -1476,7 +1556,7 @@ func (client *VirtualMachineScaleSetsClient) BeginRestart(ctx context.Context, r // Restart - Restarts one or more virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginRestart" @@ -1518,7 +1598,7 @@ func (client *VirtualMachineScaleSetsClient) restartCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1533,7 +1613,7 @@ func (client *VirtualMachineScaleSetsClient) restartCreateRequest(ctx context.Co // BeginSetOrchestrationServiceState - Changes ServiceState property for a given service // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the virtual machine scale set to create or update. // - parameters - The input object for SetOrchestrationServiceState API. @@ -1555,7 +1635,7 @@ func (client *VirtualMachineScaleSetsClient) BeginSetOrchestrationServiceState(c // SetOrchestrationServiceState - Changes ServiceState property for a given service // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceState(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsClientBeginSetOrchestrationServiceStateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginSetOrchestrationServiceState" @@ -1597,7 +1677,7 @@ func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -1609,7 +1689,7 @@ func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateCreateR // BeginStart - Starts one or more virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetsClientBeginStartOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginStart @@ -1630,7 +1710,7 @@ func (client *VirtualMachineScaleSetsClient) BeginStart(ctx context.Context, res // Start - Starts one or more virtual machines in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginStart" @@ -1672,7 +1752,7 @@ func (client *VirtualMachineScaleSetsClient) startCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1687,7 +1767,7 @@ func (client *VirtualMachineScaleSetsClient) startCreateRequest(ctx context.Cont // BeginUpdate - Update a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set to create or update. // - parameters - The scale set object. @@ -1709,7 +1789,7 @@ func (client *VirtualMachineScaleSetsClient) BeginUpdate(ctx context.Context, re // Update - Update a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginUpdate" @@ -1751,7 +1831,7 @@ func (client *VirtualMachineScaleSetsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -1763,7 +1843,7 @@ func (client *VirtualMachineScaleSetsClient) updateCreateRequest(ctx context.Con // BeginUpdateInstances - Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - vmInstanceIDs - A list of virtual machine instance IDs from the VM scale set. @@ -1785,7 +1865,7 @@ func (client *VirtualMachineScaleSetsClient) BeginUpdateInstances(ctx context.Co // UpdateInstances - Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetsClient) updateInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginUpdateInstancesOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetsClient.BeginUpdateInstances" @@ -1827,7 +1907,7 @@ func (client *VirtualMachineScaleSetsClient) updateInstancesCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, vmInstanceIDs); err != nil { 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 d7c7fe6a4254..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go +++ /dev/null @@ -1,9982 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithNetworkInterfaceWithDnsSettings.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithNetworkInterfacesWithPublicIpAddressDnsSettings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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{ - AuxiliaryMode: to.Ptr(armcompute.NetworkInterfaceAuxiliaryModeAcceleratedConnections), - AuxiliarySKU: to.Ptr(armcompute.NetworkInterfaceAuxiliarySKUA1), - 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), - PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - Name: to.Ptr("publicip"), - Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - DomainNameLabel: to.Ptr("vmsstestlabel01"), - DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesNoReuse), - }, - IdleTimeoutInMinutes: to.Ptr[int32](10), - }, - }, - 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{ - // AuxiliaryMode: to.Ptr(armcompute.NetworkInterfaceAuxiliaryModeAcceleratedConnections), - // AuxiliarySKU: to.Ptr(armcompute.NetworkInterfaceAuxiliarySKUA1), - // 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), - // PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - // Name: to.Ptr("publicip"), - // Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - // DomainNameLabel: to.Ptr("vmsstestlabel01"), - // DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesTenantReuse), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // }, - // }, - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityPostureReference.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSecurityPostureReference() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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}"), - }, - SecurityPostureReference: &armcompute.SecurityPostureReference{ - ID: to.Ptr("/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest"), - }, - 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("d12ccb3d-ab15-4794-9836-c4196392e9f2"), - // 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), - // }, - // }, - // SecurityPostureReference: &armcompute.SecurityPostureReference{ - // ID: to.Ptr("/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest"), - // }, - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdate_virtualMachineScaleSetUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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{ - { - 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{ - { - 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{ - // { - // 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{ - // { - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdate_virtualMachineScaleSetUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeallocate_virtualMachineScaleSetDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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{Hibernate: 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeallocate_virtualMachineScaleSetDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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{Hibernate: 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_DeleteInstances_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeleteInstances_virtualMachineScaleSetDeleteInstancesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_DeleteInstances_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeleteInstances_virtualMachineScaleSetDeleteInstancesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_GetInstanceView_virtualMachineScaleSetGetInstanceViewMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_GetInstanceView_virtualMachineScaleSetGetInstanceViewMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListPager_virtualMachineScaleSetListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // 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{ - // { - // 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{ - // { - // 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{ - // { - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListPager_virtualMachineScaleSetListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("eastus"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListAllPager_virtualMachineScaleSetListAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // 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{ - // { - // 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"), - // DomainNameLabelScope: to.Ptr(armcompute.DomainNameLabelScopeTypesTenantReuse), - // }, - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListAllPager_virtualMachineScaleSetListAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListSKUsPager_virtualMachineScaleSetListSkusMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListSKUsPager_virtualMachineScaleSetListSkusMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewGetOSUpgradeHistoryPager_virtualMachineScaleSetGetOsUpgradeHistoryMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewGetOSUpgradeHistoryPager_virtualMachineScaleSetGetOsUpgradeHistoryMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPowerOff_virtualMachineScaleSetPowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPowerOff_virtualMachineScaleSetPowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRestart_virtualMachineScaleSetRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRestart_virtualMachineScaleSetRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginStart_virtualMachineScaleSetStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginStart_virtualMachineScaleSetStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReapply_virtualMachineScaleSetsReapplyMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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().BeginReapply(ctx, "VirtualMachineScaleSetReapplyTestRG", "VMSSReapply-Test-ScaleSet", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReapply_virtualMachineScaleSetsReapplyMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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().BeginReapply(ctx, "VirtualMachineScaleSetReapplyTestRG", "VMSSReapply-Test-ScaleSet", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRedeploy_virtualMachineScaleSetRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRedeploy_virtualMachineScaleSetRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPerformMaintenance_virtualMachineScaleSetPerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPerformMaintenance_virtualMachineScaleSetPerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_UpdateInstances_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdateInstances_virtualMachineScaleSetUpdateInstancesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_UpdateInstances_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdateInstances_virtualMachineScaleSetUpdateInstancesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimage_virtualMachineScaleSetReimageMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimage_virtualMachineScaleSetReimageMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimageAll_virtualMachineScaleSetReimageAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimageAll_virtualMachineScaleSetReimageAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_virtualMachineScaleSetForceRecoveryServiceFabricPlatformUpdateDomainWalkMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_virtualMachineScaleSetForceRecoveryServiceFabricPlatformUpdateDomainWalkMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ConvertToSinglePlacementGroup_virtualMachineScaleSetConvertToSinglePlacementGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ConvertToSinglePlacementGroup_virtualMachineScaleSetConvertToSinglePlacementGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginSetOrchestrationServiceState_virtualMachineScaleSetSetOrchestrationServiceStateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginSetOrchestrationServiceState_virtualMachineScaleSetSetOrchestrationServiceStateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go index 3ec0fd63fbad..217a6d8266bc 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go @@ -47,7 +47,7 @@ func NewVirtualMachineScaleSetVMExtensionsClient(subscriptionID string, credenti // BeginCreateOrUpdate - The operation to create or update the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -71,7 +71,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) BeginCreateOrUpdate(ctx // CreateOrUpdate - The operation to create or update the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMExtensionsClient.BeginCreateOrUpdate" @@ -121,7 +121,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { @@ -133,7 +133,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateCreateRequ // BeginDelete - The operation to delete the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -156,7 +156,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) BeginDelete(ctx context. // Delete - The operation to delete the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMExtensionsClient.BeginDelete" @@ -206,7 +206,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) deleteCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +215,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) deleteCreateRequest(ctx // Get - The operation to get the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -275,7 +275,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) getCreateRequest(ctx con if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -293,7 +293,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) getHandleResponse(resp * // List - The operation to get all extensions of an instance in Virtual Machine Scaleset. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -348,7 +348,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) listCreateRequest(ctx co if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -366,7 +366,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) listHandleResponse(resp // BeginUpdate - The operation to update the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -390,7 +390,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) BeginUpdate(ctx context. // Update - The operation to update the VMSS VM extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMExtensionsClient.BeginUpdate" @@ -440,7 +440,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) updateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { 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 dadeb8be88e5..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Create.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Update.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Delete.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_List.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", 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.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go index 2a91478e06f2..e559fd5b7ee4 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go @@ -47,7 +47,7 @@ func NewVirtualMachineScaleSetVMRunCommandsClient(subscriptionID string, credent // BeginCreateOrUpdate - The operation to create or update the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -71,7 +71,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginCreateOrUpdate(ctx // CreateOrUpdate - The operation to create or update the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMRunCommandsClient.BeginCreateOrUpdate" @@ -121,7 +121,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} if err := runtime.MarshalAsJSON(req, runCommand); err != nil { @@ -133,7 +133,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateCreateReq // BeginDelete - The operation to delete the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -156,7 +156,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginDelete(ctx context // Delete - The operation to delete the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMRunCommandsClient.BeginDelete" @@ -206,7 +206,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -215,7 +215,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteCreateRequest(ctx // Get - The operation to get the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -275,7 +275,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) getCreateRequest(ctx co if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -292,7 +292,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) getHandleResponse(resp // NewListPager - The operation to get all run commands of an instance in Virtual Machine Scaleset. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -355,7 +355,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) listCreateRequest(ctx c if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -373,7 +373,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) listHandleResponse(resp // BeginUpdate - The operation to update the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -397,7 +397,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginUpdate(ctx context // Update - The operation to update the VMSS VM run command. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMRunCommandsClient.BeginUpdate" @@ -447,7 +447,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) updateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} if err := runtime.MarshalAsJSON(req, runCommand); err != nil { 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 0fbb24893615..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go +++ /dev/null @@ -1,291 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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), - ErrorBlobManagedIdentity: &armcompute.RunCommandManagedIdentity{}, - ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - OutputBlobManagedIdentity: &armcompute.RunCommandManagedIdentity{ - ClientID: to.Ptr("22d35efb-0c99-4041-8c5b-6d24db33a69a"), - }, - OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - 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{ - ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"), - ScriptURIManagedIdentity: &armcompute.RunCommandManagedIdentity{ - ObjectID: to.Ptr("4231e4d2-33e4-4e23-96b2-17888afa6072"), - }, - }, - TimeoutInSeconds: to.Ptr[int32](3600), - TreatFailureAsDeploymentFailure: 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.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), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // 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{ - // ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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{ - ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"), - ScriptURIManagedIdentity: &armcompute.RunCommandManagedIdentity{ - ObjectID: to.Ptr("4231e4d2-33e4-4e23-96b2-17888afa6072"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed 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), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // 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{ - // ScriptURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // 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{ - // ScriptURI: to.Ptr("https://gist.githubusercontent.com/myusername/75fd3634w7511116063c60bcc50bee0/raw/04a4c68ac9e1d36asfasdc64bd1d889b104c7abdb8/HelloWorld.ps1"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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), - // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), - // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), - // 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! ; Remove-Item C: est estFile.txt"), - // }, - // TimeoutInSeconds: to.Ptr[int32](0), - // TreatFailureAsDeploymentFailure: to.Ptr(false), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go index a802be720b73..978d45ac46e8 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go @@ -45,12 +45,89 @@ func NewVirtualMachineScaleSetVMsClient(subscriptionID string, credential azcore return client, nil } +// BeginApproveRollingUpgrade - Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01 +// - resourceGroupName - The name of the resource group. +// - vmScaleSetName - The name of the VM scale set. +// - instanceID - The instance ID of the virtual machine. +// - options - VirtualMachineScaleSetVMsClientBeginApproveRollingUpgradeOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginApproveRollingUpgrade +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginApproveRollingUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginApproveRollingUpgradeOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientApproveRollingUpgradeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.approveRollingUpgrade(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[VirtualMachineScaleSetVMsClientApproveRollingUpgradeResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientApproveRollingUpgradeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// ApproveRollingUpgrade - Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01 +func (client *VirtualMachineScaleSetVMsClient) approveRollingUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginApproveRollingUpgradeOptions) (*http.Response, error) { + var err error + const operationName = "VirtualMachineScaleSetVMsClient.BeginApproveRollingUpgrade" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.approveRollingUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// approveRollingUpgradeCreateRequest creates the ApproveRollingUpgrade request. +func (client *VirtualMachineScaleSetVMsClient) approveRollingUpgradeCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginApproveRollingUpgradeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/approveRollingUpgrade" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginDeallocate - Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases // the compute resources it uses. You are not billed for the compute resources of this virtual // machine once it is deallocated. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -74,7 +151,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginDeallocate(ctx context.Conte // machine once it is deallocated. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeallocateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginDeallocate" @@ -120,7 +197,7 @@ func (client *VirtualMachineScaleSetVMsClient) deallocateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -129,7 +206,7 @@ func (client *VirtualMachineScaleSetVMsClient) deallocateCreateRequest(ctx conte // BeginDelete - Deletes a virtual machine from a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -151,7 +228,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginDelete(ctx context.Context, // Delete - Deletes a virtual machine from a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginDelete" @@ -200,7 +277,7 @@ func (client *VirtualMachineScaleSetVMsClient) deleteCreateRequest(ctx context.C if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -209,7 +286,7 @@ func (client *VirtualMachineScaleSetVMsClient) deleteCreateRequest(ctx context.C // Get - Gets a virtual machine from a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -264,7 +341,7 @@ func (client *VirtualMachineScaleSetVMsClient) getCreateRequest(ctx context.Cont if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -282,7 +359,7 @@ func (client *VirtualMachineScaleSetVMsClient) getHandleResponse(resp *http.Resp // GetInstanceView - Gets the status of a virtual machine from a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -334,7 +411,7 @@ func (client *VirtualMachineScaleSetVMsClient) getInstanceViewCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -351,7 +428,7 @@ func (client *VirtualMachineScaleSetVMsClient) getInstanceViewHandleResponse(res // NewListPager - Gets a list of all virtual machines in a VM scale sets. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - virtualMachineScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetVMsClientListOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.NewListPager @@ -415,7 +492,7 @@ func (client *VirtualMachineScaleSetVMsClient) listCreateRequest(ctx context.Con if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -433,7 +510,7 @@ func (client *VirtualMachineScaleSetVMsClient) listHandleResponse(resp *http.Res // BeginPerformMaintenance - Performs maintenance on a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -455,7 +532,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginPerformMaintenance(ctx conte // PerformMaintenance - Performs maintenance on a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPerformMaintenanceOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginPerformMaintenance" @@ -501,7 +578,7 @@ func (client *VirtualMachineScaleSetVMsClient) performMaintenanceCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -512,7 +589,7 @@ func (client *VirtualMachineScaleSetVMsClient) performMaintenanceCreateRequest(c // charges. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -536,7 +613,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginPowerOff(ctx context.Context // charges. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPowerOffOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginPowerOff" @@ -585,7 +662,7 @@ func (client *VirtualMachineScaleSetVMsClient) powerOffCreateRequest(ctx context if options != nil && options.SkipShutdown != nil { reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -595,7 +672,7 @@ func (client *VirtualMachineScaleSetVMsClient) powerOffCreateRequest(ctx context // back on. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -618,7 +695,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginRedeploy(ctx context.Context // on. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRedeployOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginRedeploy" @@ -664,7 +741,7 @@ func (client *VirtualMachineScaleSetVMsClient) redeployCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -673,7 +750,7 @@ func (client *VirtualMachineScaleSetVMsClient) redeployCreateRequest(ctx context // BeginReimage - Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -695,7 +772,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginReimage(ctx context.Context, // Reimage - Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginReimage" @@ -741,7 +818,7 @@ func (client *VirtualMachineScaleSetVMsClient) reimageCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMScaleSetVMReimageInput != nil { @@ -757,7 +834,7 @@ func (client *VirtualMachineScaleSetVMsClient) reimageCreateRequest(ctx context. // is only supported for managed disks. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -780,7 +857,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginReimageAll(ctx context.Conte // is only supported for managed disks. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageAllOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginReimageAll" @@ -826,7 +903,7 @@ func (client *VirtualMachineScaleSetVMsClient) reimageAllCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -835,7 +912,7 @@ func (client *VirtualMachineScaleSetVMsClient) reimageAllCreateRequest(ctx conte // BeginRestart - Restarts a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -857,7 +934,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginRestart(ctx context.Context, // Restart - Restarts a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginRestart" @@ -903,7 +980,7 @@ func (client *VirtualMachineScaleSetVMsClient) restartCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -913,7 +990,7 @@ func (client *VirtualMachineScaleSetVMsClient) restartCreateRequest(ctx context. // scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -968,7 +1045,7 @@ func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataCreate if options != nil && options.SasURIExpirationTimeInMinutes != nil { reqQP.Set("sasUriExpirationTimeInMinutes", strconv.FormatInt(int64(*options.SasURIExpirationTimeInMinutes), 10)) } - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -986,7 +1063,7 @@ func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataHandle // BeginRunCommand - Run command on a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -1011,7 +1088,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginRunCommand(ctx context.Conte // RunCommand - Run command on a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) runCommand(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsClientBeginRunCommandOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginRunCommand" @@ -1057,7 +1134,7 @@ func (client *VirtualMachineScaleSetVMsClient) runCommandCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -1069,7 +1146,7 @@ func (client *VirtualMachineScaleSetVMsClient) runCommandCreateRequest(ctx conte // SimulateEviction - The operation to simulate the eviction of spot virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -1120,7 +1197,7 @@ func (client *VirtualMachineScaleSetVMsClient) simulateEvictionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1129,7 +1206,7 @@ func (client *VirtualMachineScaleSetVMsClient) simulateEvictionCreateRequest(ctx // BeginStart - Starts a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -1151,7 +1228,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginStart(ctx context.Context, r // Start - Starts a virtual machine in a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginStart" @@ -1197,7 +1274,7 @@ func (client *VirtualMachineScaleSetVMsClient) startCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1206,7 +1283,7 @@ func (client *VirtualMachineScaleSetVMsClient) startCreateRequest(ctx context.Co // BeginUpdate - Updates a virtual machine of a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set where the extension should be create or updated. // - instanceID - The instance ID of the virtual machine. @@ -1229,7 +1306,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginUpdate(ctx context.Context, // Update - Updates a virtual machine of a VM scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 func (client *VirtualMachineScaleSetVMsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineScaleSetVMsClient.BeginUpdate" @@ -1275,7 +1352,7 @@ func (client *VirtualMachineScaleSetVMsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 1af30d594585..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go +++ /dev/null @@ -1,2359 +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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVmReimageMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVmReimageMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimageAll_virtualMachineScaleSetVmReimageAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimageAll_virtualMachineScaleSetVmReimageAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginDeallocate_virtualMachineScaleSetVmDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginDeallocate_virtualMachineScaleSetVmDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginUpdate_virtualMachineScaleSetVmUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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{ - { - 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{ - { - 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{ - // { - // 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{ - // { - // 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginUpdate_virtualMachineScaleSetVmUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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, "2023-07-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, "2023-07-01T05:00:32+00:00"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("Unknown"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_NewListPager_virtualMachineScaleSetVmListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // 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{ - // { - // 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), - // }, - // }, - // 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("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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_NewListPager_virtualMachineScaleSetVmListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain 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{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPowerOff_virtualMachineScaleSetVmPowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPowerOff_virtualMachineScaleSetVmPowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRestart_virtualMachineScaleSetVmRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRestart_virtualMachineScaleSetVmRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginStart_virtualMachineScaleSetVmStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginStart_virtualMachineScaleSetVmStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRedeploy_virtualMachineScaleSetVmRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRedeploy_virtualMachineScaleSetVmRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPerformMaintenance_virtualMachineScaleSetVmPerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPerformMaintenance_virtualMachineScaleSetVmPerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", 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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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.go b/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go index 4b0d4310b28d..bc1e53d1fd8c 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go @@ -46,7 +46,7 @@ func NewVirtualMachineSizesClient(subscriptionID string, credential azcore.Token // NewListPager - This API is deprecated. Use Resources Skus [https://docs.microsoft.com/rest/api/compute/resourceskus/list] // -// Generated from API version 2023-07-01 +// Generated from API version 2023-09-01 // - location - The location upon which virtual-machine-sizes is queried. // - options - VirtualMachineSizesClientListOptions contains the optional parameters for the VirtualMachineSizesClient.NewListPager // method. @@ -90,7 +90,7 @@ func (client *VirtualMachineSizesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-07-01") + reqQP.Set("api-version", "2023-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 9699e1dd3a8f..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/v5" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-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{ - // } - } -}