From 32f17e3b8f97e139d9ccf4b999d81c13a7827a3b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 19 Apr 2023 02:24:13 +0000 Subject: [PATCH] CodeGen from PR 23621 in Azure/azure-rest-api-specs Merge 0fa9393e0fa006b4c52ece6915712dc9344cf100 into cb300dbe61c2fc39362d543318cbc7e974481cbd --- .../compute/armcompute/CHANGELOG.md | 42 + .../compute/armcompute/autorest.md | 6 +- .../armcompute/availabilitysets_client.go | 28 +- .../availabilitysets_client_example_test.go | 629 -- .../capacityreservationgroups_client.go | 24 +- ...tyreservationgroups_client_example_test.go | 402 - .../armcompute/capacityreservations_client.go | 26 +- ...apacityreservations_client_example_test.go | 386 - ...iceoperatingsystems_client_example_test.go | 207 - ...erviceroleinstances_client_example_test.go | 289 - .../cloudserviceroles_client_example_test.go | 108 - .../cloudservices_client_example_test.go | 1242 --- ...ervicesupdatedomain_client_example_test.go | 99 - .../communitygalleries_client_example_test.go | 46 - ...munitygalleryimages_client_example_test.go | 103 - ...alleryimageversions_client_example_test.go | 103 - .../compute/armcompute/constants.go | 148 +- .../armcompute/dedicatedhostgroups_client.go | 24 +- ...dedicatedhostgroups_client_example_test.go | 616 -- .../armcompute/dedicatedhosts_client.go | 106 +- .../dedicatedhosts_client_example_test.go | 425 - .../diskaccesses_client_example_test.go | 529 - .../diskencryptionsets_client_example_test.go | 657 -- .../diskrestorepoint_client_example_test.go | 183 - .../armcompute/disks_client_example_test.go | 2115 ---- .../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 | 4 +- .../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 | 904 +- .../compute/armcompute/models_serde.go | 231 +- .../compute/armcompute/operations_client.go | 4 +- .../operations_client_example_test.go | 83 - .../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 | 697 -- .../armcompute/sshpublickeys_client.go | 28 +- .../sshpublickeys_client_example_test.go | 349 - .../compute/armcompute/usage_client.go | 4 +- .../armcompute/usage_client_example_test.go | 90 - .../virtualmachineextensionimages_client.go | 12 +- ...hineextensionimages_client_example_test.go | 209 - .../virtualmachineextensions_client.go | 26 +- ...almachineextensions_client_example_test.go | 437 - .../armcompute/virtualmachineimages_client.go | 24 +- ...irtualmachineimages_client_example_test.go | 403 - .../virtualmachineimagesedgezone_client.go | 20 +- ...chineimagesedgezone_client_example_test.go | 339 - .../virtualmachineruncommands_client.go | 34 +- ...lmachineruncommands_client_example_test.go | 416 - .../armcompute/virtualmachines_client.go | 138 +- .../virtualmachines_client_example_test.go | 9120 ---------------- ...virtualmachinescalesetextensions_client.go | 26 +- ...escalesetextensions_client_example_test.go | 374 - ...almachinescalesetrollingupgrades_client.go | 22 +- ...esetrollingupgrades_client_example_test.go | 214 - .../virtualmachinescalesets_client.go | 190 +- ...ualmachinescalesets_client_example_test.go | 9571 ----------------- ...rtualmachinescalesetvmextensions_client.go | 26 +- ...calesetvmextensions_client_example_test.go | 226 - ...tualmachinescalesetvmruncommands_client.go | 26 +- ...alesetvmruncommands_client_example_test.go | 266 - .../virtualmachinescalesetvms_client.go | 86 +- ...lmachinescalesetvms_client_example_test.go | 2362 ---- .../armcompute/virtualmachinesizes_client.go | 4 +- ...virtualmachinesizes_client_example_test.go | 89 - 82 files changed, 1406 insertions(+), 40950 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 1d41ffefe884..c252857dd5ed 100644 --- a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md +++ b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md @@ -1,5 +1,47 @@ # Release History +## 5.0.0 (2023-04-19) +### Breaking Changes + +- Type of `RestorePointSourceVMDataDisk.DiskRestorePoint` has been changed from `*APIEntityReference` to `*DiskRestorePointAttributes` +- Type of `RestorePointSourceVMOSDisk.DiskRestorePoint` has been changed from `*APIEntityReference` to `*DiskRestorePointAttributes` +- Field `ID` of struct `VirtualMachineScaleSetIPConfiguration` has been removed +- Field `ID` of struct `VirtualMachineScaleSetNetworkConfiguration` has been removed +- Field `ID` of struct `VirtualMachineScaleSetUpdateIPConfiguration` has been removed +- Field `ID` of struct `VirtualMachineScaleSetUpdateNetworkConfiguration` has been removed + +### Features Added + +- New enum type `ExpandTypeForListVMs` with values `ExpandTypeForListVMsInstanceView` +- New enum type `ExpandTypesForListVMs` with values `ExpandTypesForListVMsInstanceView` +- New enum type `RestorePointEncryptionType` with values `RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey`, `RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys`, `RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey` +- New function `*DedicatedHostsClient.NewListAvailableSizesPager(string, string, string, *DedicatedHostsClientListAvailableSizesOptions) *runtime.Pager[DedicatedHostsClientListAvailableSizesResponse]` +- New function `*VirtualMachineScaleSetsClient.BeginReapply(context.Context, string, string, *VirtualMachineScaleSetsClientBeginReapplyOptions) (*runtime.Poller[VirtualMachineScaleSetsClientReapplyResponse], error)` +- New struct `DedicatedHostSizeListResult` +- New struct `DiskRestorePointAttributes` +- New struct `RestorePointEncryption` +- New struct `RunCommandManagedIdentity` +- New struct `SecurityPostureReference` +- New field `SKU` in struct `DedicatedHostUpdate` +- New field `BypassPlatformSafetyChecksOnUserSchedule` in struct `LinuxVMGuestPatchAutomaticByPlatformSettings` +- New field `HyperVGeneration` in struct `RestorePointSourceMetadata` +- New field `WriteAcceleratorEnabled` in struct `RestorePointSourceVMDataDisk` +- New field `WriteAcceleratorEnabled` in struct `RestorePointSourceVMOSDisk` +- New field `ProvisionAfterExtensions` in struct `VirtualMachineExtensionProperties` +- New field `ErrorBlobManagedIdentity` in struct `VirtualMachineRunCommandProperties` +- New field `OutputBlobManagedIdentity` in struct `VirtualMachineRunCommandProperties` +- New field `TreatFailureAsDeploymentFailure` in struct `VirtualMachineRunCommandProperties` +- New field `ScriptURIManagedIdentity` in struct `VirtualMachineRunCommandScriptSource` +- New field `PriorityMixPolicy` in struct `VirtualMachineScaleSetUpdateProperties` +- New field `SpotRestorePolicy` in struct `VirtualMachineScaleSetUpdateProperties` +- New field `Location` in struct `VirtualMachineScaleSetVMExtension` +- New field `SecurityPostureReference` in struct `VirtualMachineScaleSetVMProfile` +- New field `Hibernate` in struct `VirtualMachineScaleSetsClientBeginDeallocateOptions` +- New field `Expand` in struct `VirtualMachinesClientListAllOptions` +- New field `Expand` in struct `VirtualMachinesClientListOptions` +- New field `BypassPlatformSafetyChecksOnUserSchedule` in struct `WindowsVMGuestPatchAutomaticByPlatformSettings` + + ## 4.2.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/compute/armcompute/autorest.md b/sdk/resourcemanager/compute/armcompute/autorest.md index 31fe98659aec..f027a1114a20 100644 --- a/sdk/resourcemanager/compute/armcompute/autorest.md +++ b/sdk/resourcemanager/compute/armcompute/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/compute/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/compute/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 4.2.1 +module-version: 5.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go b/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go index 10a9f162b708..a6d6d2e44a95 100644 --- a/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go +++ b/sdk/resourcemanager/compute/armcompute/availabilitysets_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - availabilitySetName - The name of the availability set. // - parameters - Parameters supplied to the Create Availability Set operation. @@ -89,7 +89,7 @@ func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -107,7 +107,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -146,7 +146,7 @@ func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -155,7 +155,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -194,7 +194,7 @@ func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -211,7 +211,7 @@ func (client *AvailabilitySetsClient) getHandleResponse(resp *http.Response) (Av // NewListPager - Lists all availability sets in a resource group. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - options - AvailabilitySetsClientListOptions contains the optional parameters for the AvailabilitySetsClient.NewListPager // method. @@ -259,7 +259,7 @@ func (client *AvailabilitySetsClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -277,7 +277,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -324,7 +324,7 @@ func (client *AvailabilitySetsClient) listAvailableSizesCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -341,7 +341,7 @@ func (client *AvailabilitySetsClient) listAvailableSizesHandleResponse(resp *htt // NewListBySubscriptionPager - Lists all availability sets in a subscription. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - options - AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.NewListBySubscriptionPager // method. func (client *AvailabilitySetsClient) NewListBySubscriptionPager(options *AvailabilitySetsClientListBySubscriptionOptions) *runtime.Pager[AvailabilitySetsClientListBySubscriptionResponse] { @@ -384,7 +384,7 @@ func (client *AvailabilitySetsClient) listBySubscriptionCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -405,7 +405,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - availabilitySetName - The name of the availability set. // - parameters - Parameters supplied to the Update Availability Set operation. @@ -445,7 +445,7 @@ func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go b/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go deleted file mode 100644 index e026106b56ad..000000000000 --- a/sdk/resourcemanager/compute/armcompute/availabilitysets_client_example_test.go +++ /dev/null @@ -1,629 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySet_Create.json -func ExampleAvailabilitySetsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().CreateOrUpdate(ctx, "myResourceGroup", "myAvailabilitySet", armcompute.AvailabilitySet{ - Location: to.Ptr("westus"), - Properties: &armcompute.AvailabilitySetProperties{ - PlatformFaultDomainCount: to.Ptr[int32](2), - PlatformUpdateDomainCount: to.Ptr[int32](20), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Name: to.Ptr("myAvailabilitySet"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](2), - // PlatformUpdateDomainCount: to.Ptr[int32](20), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySets_Update_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Update_availabilitySetsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", armcompute.AvailabilitySetUpdate{ - Tags: map[string]*string{ - "key2574": to.Ptr("aaaaaaaa"), - }, - Properties: &armcompute.AvailabilitySetProperties{ - PlatformFaultDomainCount: to.Ptr[int32](2), - PlatformUpdateDomainCount: to.Ptr[int32](20), - ProximityPlacementGroup: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - VirtualMachines: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("DSv3-Type1"), - Capacity: to.Ptr[int64](7), - Tier: to.Ptr("aaa"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Name: to.Ptr("myAvailabilitySet"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key2505": to.Ptr("aa"), - // "key9626": to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](2), - // PlatformUpdateDomainCount: to.Ptr[int32](20), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySets_Update_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Update_availabilitySetsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.AvailabilitySetUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySets_Delete_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Delete_availabilitySetsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAvailabilitySetsClient().Delete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySets_Delete_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Delete_availabilitySetsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAvailabilitySetsClient().Delete(ctx, "rgcompute", "aaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySets_Get_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Get_availabilitySetsGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Name: to.Ptr("myAvailabilitySet"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key2505": to.Ptr("aa"), - // "key9626": to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](2), - // PlatformUpdateDomainCount: to.Ptr[int32](20), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySets_Get_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Get_availabilitySetsGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailabilitySet = armcompute.AvailabilitySet{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySet_ListBySubscription.json -func ExampleAvailabilitySetsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListBySubscriptionPager(&armcompute.AvailabilitySetsClientListBySubscriptionOptions{Expand: to.Ptr("virtualMachines\\$ref")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{ - // Value: []*armcompute.AvailabilitySet{ - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySets_List_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListPager_availabilitySetsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{ - // Value: []*armcompute.AvailabilitySet{ - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Tags: map[string]*string{ - // "key2039": to.Ptr("aaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](22), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("australiasoutheast"), - // Tags: map[string]*string{ - // "key5849": to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](23), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](26), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // { - // Name: to.Ptr("{availabilitySetName}"), - // Type: to.Ptr("Microsoft.Compute/availabilitySets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.AvailabilitySetProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // PlatformUpdateDomainCount: to.Ptr[int32](5), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:39:56.427Z"); return t}()), - // }}, - // VirtualMachines: []*armcompute.SubResource{ - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](6), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySets_List_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListPager_availabilitySetsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailabilitySetListResult = armcompute.AvailabilitySetListResult{ - // Value: []*armcompute.AvailabilitySet{ - // { - // Location: to.Ptr("australiasoutheast"), - // }, - // { - // Location: to.Ptr("australiasoutheast"), - // }, - // { - // Location: to.Ptr("westcentralus"), - // }, - // { - // Location: to.Ptr("westcentralus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySets_ListAvailableSizes_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListAvailableSizesPager_availabilitySetsListAvailableSizesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListAvailableSizesPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // Value: []*armcompute.VirtualMachineSize{ - // { - // Name: to.Ptr("Standard_A1_V2"), - // MaxDataDiskCount: to.Ptr[int32](2), - // MemoryInMB: to.Ptr[int32](2048), - // NumberOfCores: to.Ptr[int32](1), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](10240), - // }, - // { - // Name: to.Ptr("Standard_A2_V2"), - // MaxDataDiskCount: to.Ptr[int32](4), - // MemoryInMB: to.Ptr[int32](4096), - // NumberOfCores: to.Ptr[int32](2), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](20480), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/availabilitySetExamples/AvailabilitySets_ListAvailableSizes_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListAvailableSizesPager_availabilitySetsListAvailableSizesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListAvailableSizesPager("rgcompute", "aa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go b/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go index 102dfbe04c73..858a01cb4c2e 100644 --- a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client.go @@ -50,7 +50,7 @@ func NewCapacityReservationGroupsClient(subscriptionID string, credential azcore // details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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. @@ -91,7 +91,7 @@ func (client *CapacityReservationGroupsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -111,7 +111,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -151,7 +151,7 @@ func (client *CapacityReservationGroupsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -160,7 +160,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -203,7 +203,7 @@ func (client *CapacityReservationGroupsClient) getCreateRequest(ctx context.Cont if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -221,7 +221,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - options - CapacityReservationGroupsClientListByResourceGroupOptions contains the optional parameters for the CapacityReservationGroupsClient.NewListByResourceGroupPager // method. @@ -269,7 +269,7 @@ func (client *CapacityReservationGroupsClient) listByResourceGroupCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -290,7 +290,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 2022-11-01 +// Generated from API version 2023-03-01 // - options - CapacityReservationGroupsClientListBySubscriptionOptions contains the optional parameters for the CapacityReservationGroupsClient.NewListBySubscriptionPager // method. func (client *CapacityReservationGroupsClient) NewListBySubscriptionPager(options *CapacityReservationGroupsClientListBySubscriptionOptions) *runtime.Pager[CapacityReservationGroupsClientListBySubscriptionResponse] { @@ -333,7 +333,7 @@ func (client *CapacityReservationGroupsClient) listBySubscriptionCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -355,7 +355,7 @@ func (client *CapacityReservationGroupsClient) listBySubscriptionHandleResponse( // be modified. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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. @@ -396,7 +396,7 @@ func (client *CapacityReservationGroupsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go b/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go deleted file mode 100644 index bee6eacc7d35..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservationgroups_client_example_test.go +++ /dev/null @@ -1,402 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.json -func ExampleCapacityReservationGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().CreateOrUpdate(ctx, "myResourceGroup", "myCapacityReservationGroup", armcompute.CapacityReservationGroup{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("finance"), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("2")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Name: to.Ptr("myCapacityReservationGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/myCapacityReservationGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("finance"), - // "owner": to.Ptr("myCompany"), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Update_capacityReservationGroupsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationGroupUpdate{ - Tags: map[string]*string{ - "key5355": to.Ptr("aaa"), - }, - Properties: &armcompute.CapacityReservationGroupProperties{ - InstanceView: &armcompute.CapacityReservationGroupInstanceView{}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Name: to.Ptr("myCapacityReservationGroup"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/myCapacityReservationGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.CapacityReservationGroupInstanceView{ - // CapacityReservations: []*armcompute.CapacityReservationInstanceViewWithName{ - // { - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // Name: to.Ptr("aaaaaaaaaaaaaaaa"), - // }}, - // }, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MinimumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Update_capacityReservationGroupsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationGroupUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Delete_capacityReservationGroupsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCapacityReservationGroupsClient().Delete(ctx, "rgcompute", "a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json -func ExampleCapacityReservationGroupsClient_Delete_capacityReservationGroupsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCapacityReservationGroupsClient().Delete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservationGroup_Get.json -func ExampleCapacityReservationGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationGroupsClient().Get(ctx, "myResourceGroup", "myCapacityReservationGroup", &armcompute.CapacityReservationGroupsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationGroupInstanceViewTypesInstanceView)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservationGroup = armcompute.CapacityReservationGroup{ - // Name: to.Ptr("myCapacityReservationGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"), - // }}, - // InstanceView: &armcompute.CapacityReservationGroupInstanceView{ - // CapacityReservations: []*armcompute.CapacityReservationInstanceViewWithName{ - // { - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // CurrentCapacity: to.Ptr[int32](5), - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // Name: to.Ptr("myCapacityReservation1"), - // }, - // { - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // CurrentCapacity: to.Ptr[int32](5), - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"), - // }}, - // }, - // Name: to.Ptr("myCapacityReservation2"), - // }}, - // }, - // }, - // Zones: []*string{ - // to.Ptr("3"), - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.json -func ExampleCapacityReservationGroupsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapacityReservationGroupsClient().NewListByResourceGroupPager("myResourceGroup", &armcompute.CapacityReservationGroupsClientListByResourceGroupOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapacityReservationGroupListResult = armcompute.CapacityReservationGroupListResult{ - // Value: []*armcompute.CapacityReservationGroup{ - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation3"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation4"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.json -func ExampleCapacityReservationGroupsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapacityReservationGroupsClient().NewListBySubscriptionPager(&armcompute.CapacityReservationGroupsClientListBySubscriptionOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef)}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapacityReservationGroupListResult = armcompute.CapacityReservationGroupListResult{ - // Value: []*armcompute.CapacityReservationGroup{ - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup1/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("{capacityReservationGroupName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservationGroups"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.CapacityReservationGroupProperties{ - // CapacityReservations: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation3"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation4"), - // }}, - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup2/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go b/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go index f1cfacc68fa5..d814ac925d86 100644 --- a/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go +++ b/sdk/resourcemanager/compute/armcompute/capacityreservations_client.go @@ -50,7 +50,7 @@ func NewCapacityReservationsClient(subscriptionID string, credential azcore.Toke // details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *CapacityReservationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) if err != nil { @@ -114,7 +114,7 @@ func (client *CapacityReservationsClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -125,7 +125,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - capacityReservationName - The name of the capacity reservation. @@ -148,7 +148,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *CapacityReservationsClient) deleteOperation(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, options) if err != nil { @@ -188,7 +188,7 @@ func (client *CapacityReservationsClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -197,7 +197,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - capacityReservationName - The name of the capacity reservation. @@ -245,7 +245,7 @@ func (client *CapacityReservationsClient) getCreateRequest(ctx context.Context, if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,7 +263,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -316,7 +316,7 @@ func (client *CapacityReservationsClient) listByCapacityReservationGroupCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +334,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - capacityReservationGroupName - The name of the capacity reservation group. // - capacityReservationName - The name of the capacity reservation. @@ -356,7 +356,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *CapacityReservationsClient) update(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) if err != nil { @@ -396,7 +396,7 @@ func (client *CapacityReservationsClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go b/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go deleted file mode 100644 index 724ab35c60d6..000000000000 --- a/sdk/resourcemanager/compute/armcompute/capacityreservations_client_example_test.go +++ /dev/null @@ -1,386 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservation_CreateOrUpdate.json -func ExampleCapacityReservationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", armcompute.CapacityReservation{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("HR"), - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](4), - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Name: to.Ptr("myCapacityReservation"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json -func ExampleCapacityReservationsClient_BeginUpdate_capacityReservationsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", armcompute.CapacityReservationUpdate{ - Tags: map[string]*string{ - "key4974": to.Ptr("aaaaaaaaaaaaaaaa"), - }, - Properties: &armcompute.CapacityReservationProperties{ - InstanceView: &armcompute.CapacityReservationInstanceView{ - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - UtilizationInfo: &armcompute.CapacityReservationUtilization{}, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](7), - Tier: to.Ptr("aaa"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Name: to.Ptr("myCapacityReservation"), - // Type: to.Ptr("aaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // InstanceView: &armcompute.CapacityReservationInstanceView{ - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservation_Update_MinimumSet_Gen.json -func ExampleCapacityReservationsClient_BeginUpdate_capacityReservationsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaa", armcompute.CapacityReservationUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Location: to.Ptr("westus"), - // SKU: &armcompute.SKU{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json -func ExampleCapacityReservationsClient_BeginDelete_capacityReservationsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json -func ExampleCapacityReservationsClient_BeginDelete_capacityReservationsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCapacityReservationsClient().BeginDelete(ctx, "rgcompute", "aaa", "aaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservation_Get.json -func ExampleCapacityReservationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapacityReservationsClient().Get(ctx, "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", &armcompute.CapacityReservationsClientGetOptions{Expand: to.Ptr(armcompute.CapacityReservationInstanceViewTypesInstanceView)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapacityReservation = armcompute.CapacityReservation{ - // Name: to.Ptr("myCapacityReservation"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // InstanceView: &armcompute.CapacityReservationInstanceView{ - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // UtilizationInfo: &armcompute.CapacityReservationUtilization{ - // CurrentCapacity: to.Ptr[int32](5), - // VirtualMachinesAllocated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }}, - // }, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/capacityReservationExamples/CapacityReservation_ListByReservationGroup.json -func ExampleCapacityReservationsClient_NewListByCapacityReservationGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapacityReservationsClient().NewListByCapacityReservationGroupPager("myResourceGroup", "myCapacityReservationGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapacityReservationListResult = armcompute.CapacityReservationListResult{ - // Value: []*armcompute.CapacityReservation{ - // { - // Name: to.Ptr("{capacityReservationName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservations"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"), - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }, - // { - // Name: to.Ptr("{capacityReservationName}"), - // Type: to.Ptr("Microsoft.Compute/CapacityReservations"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/CapacityReservation/{capacityReservationName}"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.CapacityReservationProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // ReservationID: to.Ptr("{GUID}"), - // VirtualMachinesAssociated: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM4"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_A1_v2"), - // Capacity: to.Ptr[int64](4), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_client_example_test.go deleted file mode 100644 index 19597e85b412..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceoperatingsystems_client_example_test.go +++ /dev/null @@ -1,207 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceOSVersion_Get.json -func ExampleCloudServiceOperatingSystemsClient_GetOSVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceOperatingSystemsClient().GetOSVersion(ctx, "westus2", "WA-GUEST-OS-3.90_202010-02", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OSVersion = armcompute.OSVersion{ - // Name: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-3.90_202010-02"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSVersionProperties{ - // Family: to.Ptr("3"), - // FamilyLabel: to.Ptr("Windows Server 2012"), - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceOSVersion_List.json -func ExampleCloudServiceOperatingSystemsClient_NewListOSVersionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceOperatingSystemsClient().NewListOSVersionsPager("westus2", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OSVersionListResult = armcompute.OSVersionListResult{ - // Value: []*armcompute.OSVersion{ - // { - // Name: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-3.90_202010-02"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSVersionProperties{ - // Family: to.Ptr("3"), - // FamilyLabel: to.Ptr("Windows Server 2012"), - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }, - // }, - // { - // Name: to.Ptr("WA-GUEST-OS-4.83_202010-02"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsVersions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSVersions/WA-GUEST-OS-4.83_202010-02"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSVersionProperties{ - // Family: to.Ptr("4"), - // FamilyLabel: to.Ptr("Windows Server 2012 R2"), - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 4.83 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-4.83_202010-02"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceOSFamily_Get.json -func ExampleCloudServiceOperatingSystemsClient_GetOSFamily() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceOperatingSystemsClient().GetOSFamily(ctx, "westus2", "3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OSFamily = armcompute.OSFamily{ - // Name: to.Ptr("3"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/3"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSFamilyProperties{ - // Name: to.Ptr("3"), - // Label: to.Ptr("Windows Server 2012"), - // Versions: []*armcompute.OSVersionPropertiesBase{ - // { - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceOSFamilies_List.json -func ExampleCloudServiceOperatingSystemsClient_NewListOSFamiliesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceOperatingSystemsClient().NewListOSFamiliesPager("westus2", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OSFamilyListResult = armcompute.OSFamilyListResult{ - // Value: []*armcompute.OSFamily{ - // { - // Name: to.Ptr("3"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/3"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSFamilyProperties{ - // Name: to.Ptr("3"), - // Label: to.Ptr("Windows Server 2012"), - // Versions: []*armcompute.OSVersionPropertiesBase{ - // { - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 3.90 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-3.90_202010-02"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("4"), - // Type: to.Ptr("Microsoft.Compute/locations/cloudServiceOsFamilies"), - // ID: to.Ptr("/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus2/cloudServiceOSFamilies/4"), - // Location: to.Ptr("westus2"), - // Properties: &armcompute.OSFamilyProperties{ - // Name: to.Ptr("4"), - // Label: to.Ptr("Windows Server 2012 R2"), - // Versions: []*armcompute.OSVersionPropertiesBase{ - // { - // IsActive: to.Ptr(true), - // IsDefault: to.Ptr(true), - // Label: to.Ptr("Windows Azure Guest OS 4.83 (Release 202010-02)"), - // Version: to.Ptr("WA-GUEST-OS-4.83_202010-02"), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go deleted file mode 100644 index 83979ebf2e32..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceroleinstances_client_example_test.go +++ /dev/null @@ -1,289 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Delete.json -func ExampleCloudServiceRoleInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().BeginDelete(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Get.json -func ExampleCloudServiceRoleInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceRoleInstancesClient().Get(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleInstance = armcompute.RoleInstance{ - // Name: to.Ptr("{roleInstance-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/{roleInstance-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/{roleInstance-name}/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Get_InstanceView.json -func ExampleCloudServiceRoleInstancesClient_GetInstanceView() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceRoleInstancesClient().GetInstanceView(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleInstanceView = armcompute.RoleInstanceView{ - // PlatformFaultDomain: to.Ptr[int32](0), - // PlatformUpdateDomain: to.Ptr[int32](0), - // PrivateID: to.Ptr("3491bc0c-1f6c-444f-b1d0-ec0751a74e3e"), - // Statuses: []*armcompute.ResourceInstanceViewStatus{ - // { - // Code: to.Ptr("RoleState/RoleStateStarted"), - // DisplayStatus: to.Ptr("RoleStateStarted"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr(""), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRolesInstance_List.json -func ExampleCloudServiceRoleInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceRoleInstancesClient().NewListPager("ConstosoRG", "{cs-name}", &armcompute.CloudServiceRoleInstancesClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleInstanceListResult = armcompute.RoleInstanceListResult{ - // Value: []*armcompute.RoleInstance{ - // { - // Name: to.Ptr("ContosoFrontend_IN_0"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_0"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_0/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoFrontend_IN_1"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_1"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoFrontend_IN_1/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend_IN_0"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_0"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_0/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend_IN_1"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roleInstances"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_1"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.RoleInstanceProperties{ - // NetworkProfile: &armcompute.RoleInstanceNetworkProfile{ - // NetworkInterfaces: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roleInstances/ContosoBackend_IN_1/networkInterfaces/nic1"), - // }}, - // }, - // }, - // SKU: &armcompute.InstanceSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Restart.json -func ExampleCloudServiceRoleInstancesClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().BeginRestart(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Reimage.json -func ExampleCloudServiceRoleInstancesClient_BeginReimage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().BeginReimage(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Rebuild.json -func ExampleCloudServiceRoleInstancesClient_BeginRebuild() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServiceRoleInstancesClient().BeginRebuild(ctx, "{roleInstance-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Get_RemoteDesktopFile.json -func ExampleCloudServiceRoleInstancesClient_GetRemoteDesktopFile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCloudServiceRoleInstancesClient().GetRemoteDesktopFile(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "rgcloudService", "aaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go deleted file mode 100644 index 8a3ee4694386..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudserviceroles_client_example_test.go +++ /dev/null @@ -1,108 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRole_Get.json -func ExampleCloudServiceRolesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServiceRolesClient().Get(ctx, "{role-name}", "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudServiceRole = armcompute.CloudServiceRole{ - // Name: to.Ptr("{role-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roles"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/{role-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceRoleProperties{ - // UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:{role-name}"), - // }, - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRole_List.json -func ExampleCloudServiceRolesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServiceRolesClient().NewListPager("ConstosoRG", "{cs-name}", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CloudServiceRoleListResult = armcompute.CloudServiceRoleListResult{ - // Value: []*armcompute.CloudServiceRole{ - // { - // Name: to.Ptr("ContosoFrontend"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roles"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/ContosoFrontend"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceRoleProperties{ - // UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:ContosoFrontend"), - // }, - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // Type: to.Ptr("Microsoft.Compute/cloudServices/roles"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/roles/ContosoBackend"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceRoleProperties{ - // UniqueID: to.Ptr("b03bc269-766b-4921-b91a-7dffaae4d03b:ContosoBackend"), - // }, - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go deleted file mode 100644 index 9043a684ec78..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudservices_client_example_test.go +++ /dev/null @@ -1,1242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithMultiRole.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithMultipleRoles() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{ - Location: to.Ptr("westus"), - Properties: &armcompute.CloudServiceProperties{ - Configuration: to.Ptr("{ServiceConfiguration}"), - NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - { - Name: to.Ptr("contosolb"), - Properties: &armcompute.LoadBalancerConfigurationProperties{ - FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - { - Name: to.Ptr("contosofe"), - Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - PublicIPAddress: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - }, - }, - }}, - }, - }}, - }, - PackageURL: to.Ptr("{PackageUrl}"), - RoleProfile: &armcompute.CloudServiceRoleProfile{ - Roles: []*armcompute.CloudServiceRoleProfileProperties{ - { - Name: to.Ptr("ContosoFrontend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }, - { - Name: to.Ptr("ContosoBackend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }}, - }, - UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.CloudServiceProperties{ - // Configuration: to.Ptr("{ServiceConfiguration}"), - // NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - // LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - // { - // Name: to.Ptr("contosolb"), - // Properties: &armcompute.LoadBalancerConfigurationProperties{ - // FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - // { - // Name: to.Ptr("contosofe"), - // Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - // PublicIPAddress: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("7f3edf91-cb34-4a3e-971a-177dc3dd43cb"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithMultiRole_WithZones.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithMultipleRolesInASpecificAvailabilityZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{ - Location: to.Ptr("westus"), - Properties: &armcompute.CloudServiceProperties{ - Configuration: to.Ptr("{ServiceConfiguration}"), - NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - { - Name: to.Ptr("contosolb"), - Properties: &armcompute.LoadBalancerConfigurationProperties{ - FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - { - Name: to.Ptr("contosofe"), - Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - PublicIPAddress: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - }, - }, - }}, - }, - }}, - }, - PackageURL: to.Ptr("{PackageUrl}"), - RoleProfile: &armcompute.CloudServiceRoleProfile{ - Roles: []*armcompute.CloudServiceRoleProfileProperties{ - { - Name: to.Ptr("ContosoFrontend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }, - { - Name: to.Ptr("ContosoBackend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }}, - }, - UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.CloudServiceProperties{ - // Configuration: to.Ptr("{ServiceConfiguration}"), - // NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - // LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - // { - // Name: to.Ptr("contosolb"), - // Properties: &armcompute.LoadBalancerConfigurationProperties{ - // FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - // { - // Name: to.Ptr("contosofe"), - // Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - // PublicIPAddress: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("7f3edf91-cb34-4a3e-971a-177dc3dd43cb"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRole.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRole() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{ - Location: to.Ptr("westus"), - Properties: &armcompute.CloudServiceProperties{ - Configuration: to.Ptr("{ServiceConfiguration}"), - NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - { - Name: to.Ptr("myLoadBalancer"), - Properties: &armcompute.LoadBalancerConfigurationProperties{ - FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - { - Name: to.Ptr("myfe"), - Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - PublicIPAddress: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"), - }, - }, - }}, - }, - }}, - }, - PackageURL: to.Ptr("{PackageUrl}"), - RoleProfile: &armcompute.CloudServiceRoleProfile{ - Roles: []*armcompute.CloudServiceRoleProfileProperties{ - { - Name: to.Ptr("ContosoFrontend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }}, - }, - UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/5393f919-a68a-43d0-9063-4b2bda6bffdf/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.CloudServiceProperties{ - // Configuration: to.Ptr("{ServiceConfiguration}"), - // NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - // LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - // { - // Name: to.Ptr("myLoadBalancer"), - // Properties: &armcompute.LoadBalancerConfigurationProperties{ - // FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - // { - // Name: to.Ptr("myfe"), - // Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - // PublicIPAddress: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("14d10b45-ced7-42ef-a406-50a3df2cea7d"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRoleAndCertificate.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRoleAndCertificateFromKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{ - Location: to.Ptr("westus"), - Properties: &armcompute.CloudServiceProperties{ - Configuration: to.Ptr("{ServiceConfiguration}"), - NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - { - Name: to.Ptr("contosolb"), - Properties: &armcompute.LoadBalancerConfigurationProperties{ - FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - { - Name: to.Ptr("contosofe"), - Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - PublicIPAddress: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - }, - }, - }}, - }, - }}, - }, - OSProfile: &armcompute.CloudServiceOsProfile{ - Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - { - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"), - }, - VaultCertificates: []*armcompute.CloudServiceVaultCertificate{ - { - CertificateURL: to.Ptr("https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"), - }}, - }}, - }, - PackageURL: to.Ptr("{PackageUrl}"), - RoleProfile: &armcompute.CloudServiceRoleProfile{ - Roles: []*armcompute.CloudServiceRoleProfileProperties{ - { - Name: to.Ptr("ContosoFrontend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }}, - }, - UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.CloudServiceProperties{ - // Configuration: to.Ptr("{ServiceConfiguration}"), - // NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - // LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - // { - // Name: to.Ptr("contosolb"), - // Properties: &armcompute.LoadBalancerConfigurationProperties{ - // FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - // { - // Name: to.Ptr("contosofe"), - // Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - // PublicIPAddress: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // { - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"), - // }, - // VaultCertificates: []*armcompute.CloudServiceVaultCertificate{ - // { - // CertificateURL: to.Ptr("https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"), - // }}, - // }}, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("60b6cd59-600b-4e02-b717-521b07aa94bf"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRoleAndRDP.json -func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRoleAndRdpExtension() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{ - Location: to.Ptr("westus"), - Properties: &armcompute.CloudServiceProperties{ - Configuration: to.Ptr("{ServiceConfiguration}"), - ExtensionProfile: &armcompute.CloudServiceExtensionProfile{ - Extensions: []*armcompute.Extension{ - { - Name: to.Ptr("RDPExtension"), - Properties: &armcompute.CloudServiceExtensionProperties{ - Type: to.Ptr("RDP"), - AutoUpgradeMinorVersion: to.Ptr(false), - ProtectedSettings: "{password}", - Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - Settings: "UserAzure10/22/2021 15:05:45", - TypeHandlerVersion: to.Ptr("1.2"), - }, - }}, - }, - NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - { - Name: to.Ptr("contosolb"), - Properties: &armcompute.LoadBalancerConfigurationProperties{ - FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - { - Name: to.Ptr("contosofe"), - Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - PublicIPAddress: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - }, - }, - }}, - }, - }}, - }, - PackageURL: to.Ptr("{PackageUrl}"), - RoleProfile: &armcompute.CloudServiceRoleProfile{ - Roles: []*armcompute.CloudServiceRoleProfileProperties{ - { - Name: to.Ptr("ContosoFrontend"), - SKU: &armcompute.CloudServiceRoleSKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](1), - Tier: to.Ptr("Standard"), - }, - }}, - }, - UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.CloudServiceProperties{ - // Configuration: to.Ptr("{ServiceConfiguration}"), - // ExtensionProfile: &armcompute.CloudServiceExtensionProfile{ - // Extensions: []*armcompute.Extension{ - // { - // Name: to.Ptr("RDPExtension"), - // Properties: &armcompute.CloudServiceExtensionProperties{ - // Type: to.Ptr("RDP"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // Settings: "UserAzure10/22/2021 15:05:45", - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - // LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - // { - // Name: to.Ptr("contosolb"), - // Properties: &armcompute.LoadBalancerConfigurationProperties{ - // FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - // { - // Name: to.Ptr("contosofe"), - // Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - // PublicIPAddress: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // PackageURL: to.Ptr("{PackageUrl}"), - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("c948cccb-bbfa-4516-a250-c28abc4d0c15"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Update_ToIncludeTags.json -func ExampleCloudServicesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudServiceUpdate{ - Tags: map[string]*string{ - "Documentation": to.Ptr("RestAPI"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceProperties{ - // Configuration: to.Ptr("{ServiceConfiguration}"), - // NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - // LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - // { - // Name: to.Ptr("contosolb"), - // Properties: &armcompute.LoadBalancerConfigurationProperties{ - // FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - // { - // Name: to.Ptr("contosofe"), - // Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - // PublicIPAddress: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // Tags: map[string]*string{ - // "Documentation": to.Ptr("RestAPI"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Delete.json -func ExampleCloudServicesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginDelete(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Get_WithMultiRoleAndRDP.json -func ExampleCloudServicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServicesClient().Get(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudService = armcompute.CloudService{ - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceProperties{ - // Configuration: to.Ptr("{ServiceConfiguration}"), - // ExtensionProfile: &armcompute.CloudServiceExtensionProfile{ - // Extensions: []*armcompute.Extension{ - // { - // Name: to.Ptr("RDPExtension"), - // Properties: &armcompute.CloudServiceExtensionProperties{ - // Type: to.Ptr("RDP"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // Settings: "userazure01/12/2022 16:29:02", - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - // LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - // { - // Name: to.Ptr("contosolb"), - // Properties: &armcompute.LoadBalancerConfigurationProperties{ - // FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - // { - // Name: to.Ptr("contosofe"), - // Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - // PublicIPAddress: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // SystemData: &armcompute.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Get_InstanceViewWithMultiRole.json -func ExampleCloudServicesClient_GetInstanceView() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServicesClient().GetInstanceView(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudServiceInstanceView = armcompute.CloudServiceInstanceView{ - // PrivateIDs: []*string{ - // to.Ptr("3491bc0c-1f6c-444f-b1d0-ec0751a74e3e")}, - // RoleInstance: &armcompute.InstanceViewStatusesSummary{ - // StatusesSummary: []*armcompute.StatusCodeCount{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // Count: to.Ptr[int32](4), - // }, - // { - // Code: to.Ptr("PowerState/started"), - // Count: to.Ptr[int32](4), - // }, - // { - // Code: to.Ptr("RoleState/RoleStateStarted"), - // Count: to.Ptr[int32](4), - // }}, - // }, - // SdkVersion: to.Ptr("2.9.6496.3"), - // Statuses: []*armcompute.ResourceInstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-12T16:50:07.0953535+05:30"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/started"), - // DisplayStatus: to.Ptr("Started"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-12T16:50:07.0953535+05:30"); return t}()), - // }, - // { - // Code: to.Ptr("CurrentUpgradeDomain/-1"), - // DisplayStatus: to.Ptr("Current Upgrade Domain of cloud service is -1."), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("MaxUpgradeDomain/1"), - // DisplayStatus: to.Ptr("Max Upgrade Domain of cloud service is 1."), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_List_BySubscription.json -func ExampleCloudServicesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServicesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CloudServiceListResult = armcompute.CloudServiceListResult{ - // Value: []*armcompute.CloudService{ - // { - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceProperties{ - // Configuration: to.Ptr("{ServiceConfiguration}"), - // ExtensionProfile: &armcompute.CloudServiceExtensionProfile{ - // Extensions: []*armcompute.Extension{ - // { - // Name: to.Ptr("RDPExtension"), - // Properties: &armcompute.CloudServiceExtensionProperties{ - // Type: to.Ptr("RDP"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // Settings: "userazure01/12/2022 16:29:02", - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - // LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - // { - // Name: to.Ptr("contosolb"), - // Properties: &armcompute.LoadBalancerConfigurationProperties{ - // FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - // { - // Name: to.Ptr("contosofe"), - // Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - // PublicIPAddress: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_List_ByResourceGroup.json -func ExampleCloudServicesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServicesClient().NewListPager("ConstosoRG", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CloudServiceListResult = armcompute.CloudServiceListResult{ - // Value: []*armcompute.CloudService{ - // { - // Name: to.Ptr("{cs-name}"), - // Type: to.Ptr("Microsoft.Compute/cloudServices"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.CloudServiceProperties{ - // Configuration: to.Ptr("{ServiceConfiguration}"), - // ExtensionProfile: &armcompute.CloudServiceExtensionProfile{ - // Extensions: []*armcompute.Extension{ - // { - // Name: to.Ptr("RDPExtension"), - // Properties: &armcompute.CloudServiceExtensionProperties{ - // Type: to.Ptr("RDP"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"), - // RolesAppliedTo: []*string{ - // to.Ptr("*")}, - // Settings: "userazure01/12/2022 16:29:02", - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.CloudServiceNetworkProfile{ - // LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{ - // { - // Name: to.Ptr("contosolb"), - // Properties: &armcompute.LoadBalancerConfigurationProperties{ - // FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{ - // { - // Name: to.Ptr("contosofe"), - // Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{ - // PublicIPAddress: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"), - // }, - // }, - // }}, - // }, - // }}, - // }, - // OSProfile: &armcompute.CloudServiceOsProfile{ - // Secrets: []*armcompute.CloudServiceVaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RoleProfile: &armcompute.CloudServiceRoleProfile{ - // Roles: []*armcompute.CloudServiceRoleProfileProperties{ - // { - // Name: to.Ptr("ContosoFrontend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBackend"), - // SKU: &armcompute.CloudServiceRoleSKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // }, - // UniqueID: to.Ptr("4ccb4323-4740-4545-bb81-780b27375947"), - // UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Start.json -func ExampleCloudServicesClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginStart(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_PowerOff.json -func ExampleCloudServicesClient_BeginPowerOff() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginPowerOff(ctx, "ConstosoRG", "{cs-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Restart_ByCloudService.json -func ExampleCloudServicesClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginRestart(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginRestartOptions{Parameters: &armcompute.RoleInstances{ - RoleInstances: []*string{ - to.Ptr("ContosoFrontend_IN_0"), - to.Ptr("ContosoBackend_IN_1")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Reimage_ByCloudService.json -func ExampleCloudServicesClient_BeginReimage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginReimage(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginReimageOptions{Parameters: &armcompute.RoleInstances{ - RoleInstances: []*string{ - to.Ptr("ContosoFrontend_IN_0"), - to.Ptr("ContosoBackend_IN_1")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Rebuild_ByCloudService.json -func ExampleCloudServicesClient_BeginRebuild() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginRebuild(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginRebuildOptions{Parameters: &armcompute.RoleInstances{ - RoleInstances: []*string{ - to.Ptr("ContosoFrontend_IN_0"), - to.Ptr("ContosoBackend_IN_1")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceRoleInstance_Delete_ByCloudService.json -func ExampleCloudServicesClient_BeginDeleteInstances() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesClient().BeginDeleteInstances(ctx, "ConstosoRG", "{cs-name}", &armcompute.CloudServicesClientBeginDeleteInstancesOptions{Parameters: &armcompute.RoleInstances{ - RoleInstances: []*string{ - to.Ptr("ContosoFrontend_IN_0"), - to.Ptr("ContosoBackend_IN_1")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go b/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go deleted file mode 100644 index d97c77acd9bb..000000000000 --- a/sdk/resourcemanager/compute/armcompute/cloudservicesupdatedomain_client_example_test.go +++ /dev/null @@ -1,99 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceUpdateDomain_Update.json -func ExampleCloudServicesUpdateDomainClient_BeginWalkUpdateDomain() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudServicesUpdateDomainClient().BeginWalkUpdateDomain(ctx, "ConstosoRG", "{cs-name}", 1, armcompute.UpdateDomain{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceUpdateDomain_Get.json -func ExampleCloudServicesUpdateDomainClient_GetUpdateDomain() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudServicesUpdateDomainClient().GetUpdateDomain(ctx, "ConstosoRG", "{cs-name}", 1, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UpdateDomain = armcompute.UpdateDomain{ - // Name: to.Ptr("1"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/1"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudServiceUpdateDomain_List.json -func ExampleCloudServicesUpdateDomainClient_NewListUpdateDomainsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudServicesUpdateDomainClient().NewListUpdateDomainsPager("ConstosoRG", "{cs-name}", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UpdateDomainListResult = armcompute.UpdateDomainListResult{ - // Value: []*armcompute.UpdateDomain{ - // { - // Name: to.Ptr("0"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/0"), - // }, - // { - // Name: to.Ptr("1"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}/updateDomains/1"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go deleted file mode 100644 index 5dc0a3d0c403..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleries_client_example_test.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGallery_Get.json -func ExampleCommunityGalleriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCommunityGalleriesClient().Get(ctx, "myLocation", "publicGalleryName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommunityGallery = armcompute.CommunityGallery{ - // Name: to.Ptr("publicGalleryName"), - // Type: to.Ptr("Microsoft.Compute/Locations/CommunityGallery"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName"), - // }, - // Location: to.Ptr("myLocation"), - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go deleted file mode 100644 index fbb2a852a0c7..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimages_client_example_test.go +++ /dev/null @@ -1,103 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImage_Get.json -func ExampleCommunityGalleryImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCommunityGalleryImagesClient().Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommunityGalleryImage = armcompute.CommunityGalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // Type: to.Ptr("Microsoft.Compute/Locations/CommunityGalleryImage"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageProperties{ - // Eula: to.Ptr("https://www.microsoft.com/en-us/"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Identifier: &armcompute.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PrivacyStatementURI: to.Ptr("https://www.microsoft.com/en-us/"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImage_List.json -func ExampleCommunityGalleryImagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCommunityGalleryImagesClient().NewListPager("myLocation", "publicGalleryName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CommunityGalleryImageList = armcompute.CommunityGalleryImageList{ - // Value: []*armcompute.CommunityGalleryImage{ - // { - // Name: to.Ptr("myGalleryImageName"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageProperties{ - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Identifier: &armcompute.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go deleted file mode 100644 index 0b584eb34234..000000000000 --- a/sdk/resourcemanager/compute/armcompute/communitygalleryimageversions_client_example_test.go +++ /dev/null @@ -1,103 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_Get.json -func ExampleCommunityGalleryImageVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCommunityGalleryImageVersionsClient().Get(ctx, "myLocation", "publicGalleryName", "myGalleryImageName", "myGalleryImageVersionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommunityGalleryImageVersion = armcompute.CommunityGalleryImageVersion{ - // Name: to.Ptr("myGalleryImageVersionName"), - // Type: to.Ptr("Microsoft.Compute/Locations/CommunityGalleryImageVersion"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageVersionProperties{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_List.json -func ExampleCommunityGalleryImageVersionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCommunityGalleryImageVersionsClient().NewListPager("myLocation", "publicGalleryName", "myGalleryImageName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CommunityGalleryImageVersionList = armcompute.CommunityGalleryImageVersionList{ - // Value: []*armcompute.CommunityGalleryImageVersion{ - // { - // Name: to.Ptr("myGalleryImageVersionName"), - // Identifier: &armcompute.CommunityGalleryIdentifier{ - // UniqueID: to.Ptr("/CommunityGalleries/publicGalleryName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Location: to.Ptr("myLocation"), - // Properties: &armcompute.CommunityGalleryImageVersionProperties{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/constants.go b/sdk/resourcemanager/compute/armcompute/constants.go index 930294357692..1977a1d9750b 100644 --- a/sdk/resourcemanager/compute/armcompute/constants.go +++ b/sdk/resourcemanager/compute/armcompute/constants.go @@ -11,7 +11,7 @@ package armcompute const ( moduleName = "armcompute" - moduleVersion = "v4.2.1" + moduleVersion = "v5.0.0" ) type AccessLevel string @@ -118,12 +118,8 @@ func PossibleAvailabilitySetSKUTypesValues() []AvailabilitySetSKUTypes { } } -// CachingTypes - Specifies the caching requirements. -// Possible values are: -// None -// ReadOnly -// ReadWrite -// Default: None for Standard storage. ReadOnly for Premium storage +// CachingTypes - Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: +// None for Standard storage. ReadOnly for Premium storage type CachingTypes string const ( @@ -287,12 +283,7 @@ func PossibleDataAccessAuthModeValues() []DataAccessAuthMode { } // DedicatedHostLicenseTypes - Specifies the software license type that will be applied to the VMs deployed on the dedicated -// host. -// Possible values are: -// None -// WindowsServerHybrid -// WindowsServerPerpetual -// Default: None +// host. Possible values are: None, WindowsServerHybrid, WindowsServerPerpetual. The default value is: None. type DedicatedHostLicenseTypes string const ( @@ -365,8 +356,9 @@ func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { // is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 // (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned // as part of VM sku capabilities in the response of Microsoft.Compute SKUs -// api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list) . -// For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes. +// api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list). For more information about +// Disk Controller Types supported please refer to +// https://aka.ms/azure-diskcontrollertypes. type DiskControllerTypes string const ( @@ -429,12 +421,11 @@ func PossibleDiskCreateOptionValues() []DiskCreateOption { } } -// DiskCreateOptionTypes - Specifies how the virtual machine should be created. -// Possible values are: -// Attach \u2013 This value is used when you are using a specialized disk to create the virtual machine. -// FromImage \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform -// image, you also use the imageReference element described above. If you are -// using a marketplace image, you also use the plan element previously described. +// DiskCreateOptionTypes - Specifies how the virtual machine should be created. Possible values are: Attach. This value is +// used when you are using a specialized disk to create the virtual machine. FromImage. This value is used +// when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference +// element described above. If you are using a marketplace image, you also +// use the plan element previously described. type DiskCreateOptionTypes string const ( @@ -452,11 +443,10 @@ func PossibleDiskCreateOptionTypesValues() []DiskCreateOptionTypes { } } -// DiskDeleteOptionTypes - Specifies the behavior of the managed disk when the VM gets deleted i.e whether the managed disk -// is deleted or detached. Supported values: -// Delete If this value is used, the managed disk is deleted when VM gets deleted. -// Detach If this value is used, the managed disk is retained after VM gets deleted. -// Minimum api-version: 2021-03-01 +// DiskDeleteOptionTypes - Specifies the behavior of the managed disk when the VM gets deleted, for example whether the managed +// disk is deleted or detached. Supported values are: Delete. If this value is used, the managed disk +// is deleted when VM gets deleted. Detach. If this value is used, the managed disk is retained after VM gets deleted. Minimum +// api-version: 2021-03-01. type DiskDeleteOptionTypes string const ( @@ -473,13 +463,13 @@ func PossibleDiskDeleteOptionTypesValues() []DiskDeleteOptionTypes { } // DiskDetachOptionTypes - Specifies the detach behavior to be used while detaching a disk or which is already in the process -// of detachment from the virtual machine. Supported values: ForceDetach. -// detachOption: ForceDetach is applicable only for managed data disks. If a previous detachment attempt of the data disk -// did not complete due to an unexpected failure from the virtual machine and the -// disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes -// might not have been flushed when using this detach behavior. -// This feature is still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update -// toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. +// of detachment from the virtual machine. Supported values are: ForceDetach. detachOption: ForceDetach +// is applicable only for managed data disks. If a previous detachment attempt of the data disk did not complete due to an +// unexpected failure from the virtual machine and the disk is still not released +// then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed +// when using this detach behavior. This feature is still in preview mode and +// is not supported for VirtualMachineScaleSet. To force-detach a data disk update toBeDetached to 'true' along with setting +// detachOption: 'ForceDetach'. type DiskDetachOptionTypes string const ( @@ -693,6 +683,19 @@ func PossibleExecutionStateValues() []ExecutionState { } } +type ExpandTypeForListVMs string + +const ( + ExpandTypeForListVMsInstanceView ExpandTypeForListVMs = "instanceView" +) + +// PossibleExpandTypeForListVMsValues returns the possible values for the ExpandTypeForListVMs const type. +func PossibleExpandTypeForListVMsValues() []ExpandTypeForListVMs { + return []ExpandTypeForListVMs{ + ExpandTypeForListVMsInstanceView, + } +} + type ExpandTypesForGetCapacityReservationGroups string const ( @@ -721,6 +724,19 @@ func PossibleExpandTypesForGetVMScaleSetsValues() []ExpandTypesForGetVMScaleSets } } +type ExpandTypesForListVMs string + +const ( + ExpandTypesForListVMsInstanceView ExpandTypesForListVMs = "instanceView" +) + +// PossibleExpandTypesForListVMsValues returns the possible values for the ExpandTypesForListVMs const type. +func PossibleExpandTypesForListVMsValues() []ExpandTypesForListVMs { + return []ExpandTypesForListVMs{ + ExpandTypesForListVMsInstanceView, + } +} + // ExtendedLocationType - The type of the extended location. type ExtendedLocationType string @@ -1351,10 +1367,7 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } -// ProtocolTypes - Specifies the protocol of WinRM listener. -// Possible values are: -// http -// https +// ProtocolTypes - Specifies the protocol of WinRM listener. Possible values are: http, https. type ProtocolTypes string const ( @@ -1370,10 +1383,8 @@ func PossibleProtocolTypesValues() []ProtocolTypes { } } -// ProximityPlacementGroupType - Specifies the type of the proximity placement group. -// Possible values are: -// Standard : Co-locate resources within an Azure region or Availability Zone. -// Ultra : For future use. +// ProximityPlacementGroupType - Specifies the type of the proximity placement group. Possible values are: Standard : Co-locate +// resources within an Azure region or Availability Zone. Ultra : For future use. type ProximityPlacementGroupType string const ( @@ -1612,6 +1623,30 @@ func PossibleRestorePointCollectionExpandOptionsValues() []RestorePointCollectio } } +// RestorePointEncryptionType - The type of key used to encrypt the data of the disk restore point. +type RestorePointEncryptionType string + +const ( + // RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey - Disk Restore Point is encrypted at rest with Customer managed + // key that can be changed and revoked by a customer. + RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey RestorePointEncryptionType = "EncryptionAtRestWithCustomerKey" + // RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys - Disk Restore Point is encrypted at rest with 2 + // layers of encryption. One of the keys is Customer managed and the other key is Platform managed. + RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys RestorePointEncryptionType = "EncryptionAtRestWithPlatformAndCustomerKeys" + // RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey - Disk Restore Point is encrypted at rest with Platform managed + // key. + RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey RestorePointEncryptionType = "EncryptionAtRestWithPlatformKey" +) + +// PossibleRestorePointEncryptionTypeValues returns the possible values for the RestorePointEncryptionType const type. +func PossibleRestorePointEncryptionTypeValues() []RestorePointEncryptionType { + return []RestorePointEncryptionType{ + RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey, + RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys, + RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey, + } +} + type RestorePointExpandOptions string const ( @@ -1661,10 +1696,9 @@ func PossibleRollingUpgradeStatusCodeValues() []RollingUpgradeStatusCode { } } -// SecurityEncryptionTypes - Specifies the EncryptionType of the managed disk. -// It is set to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, and VMGuestStateOnly -// for encryption of just the VMGuestState blob. -// NOTE: It can be set for only Confidential VMs. +// SecurityEncryptionTypes - Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for encryption +// of the managed disk along with VMGuestState blob, and VMGuestStateOnly for encryption of just the +// VMGuestState blob. Note: It can be set for only Confidential VMs. type SecurityEncryptionTypes string const ( @@ -1681,7 +1715,8 @@ func PossibleSecurityEncryptionTypesValues() []SecurityEncryptionTypes { } // SecurityTypes - Specifies the SecurityType of the virtual machine. It has to be set to any specified value to enable UefiSettings. -// Default: UefiSettings will not be enabled unless this property is set. +// The default behavior is: UefiSettings will not be enabled unless this property is +// set. type SecurityTypes string const ( @@ -2111,8 +2146,8 @@ func PossibleVirtualMachineEvictionPolicyTypesValues() []VirtualMachineEvictionP } // VirtualMachinePriorityTypes - Specifies the priority for a standalone virtual machine or the virtual machines in the scale -// set. -// 'Low' enum will be deprecated in the future, please use 'Spot' as the enum to deploy Azure Spot VM/VMSS. +// set. 'Low' enum will be deprecated in the future, please use 'Spot' as the enum to deploy Azure Spot +// VM/VMSS. type VirtualMachinePriorityTypes string const ( @@ -2163,15 +2198,14 @@ func PossibleVirtualMachineScaleSetScaleInRulesValues() []VirtualMachineScaleSet } } -// VirtualMachineSizeTypes - Specifies the size of the virtual machine. -// The enum data type is currently deprecated and will be removed by December 23rd 2023. -// Recommended way to get the list of available sizes is using these APIs: -// List all available virtual machine sizes in an availability set [https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes] -// List all available virtual machine sizes in a region [https://docs.microsoft.com/rest/api/compute/resourceskus/list] -// List all available virtual machine sizes for resizing [https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes]. -// For more information about virtual machine sizes, see Sizes for -// virtual machines [https://docs.microsoft.com/azure/virtual-machines/sizes]. -// The available VM sizes depend on region and availability set. +// VirtualMachineSizeTypes - Specifies the size of the virtual machine. The enum data type is currently deprecated and will +// be removed by December 23rd 2023. The recommended way to get the list of available sizes is using these +// APIs: List all available virtual machine sizes in an availability set [https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes], +// List all available virtual machine sizes in a +// region [https://docs.microsoft.com/rest/api/compute/resourceskus/list], List all available virtual machine sizes for resizing +// [https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes]. For more information about virtual machine +// sizes, see Sizes for virtual machines +// [https://docs.microsoft.com/azure/virtual-machines/sizes]. The available VM sizes depend on region and availability set. type VirtualMachineSizeTypes string const ( diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go b/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go index 757e6926b180..5c239087b6bd 100644 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client.go @@ -49,7 +49,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -90,7 +90,7 @@ func (client *DedicatedHostGroupsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -108,7 +108,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -148,7 +148,7 @@ func (client *DedicatedHostGroupsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -157,7 +157,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -199,7 +199,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -217,7 +217,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - options - DedicatedHostGroupsClientListByResourceGroupOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListByResourceGroupPager // method. @@ -265,7 +265,7 @@ func (client *DedicatedHostGroupsClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,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 2022-11-01 +// Generated from API version 2023-03-01 // - options - DedicatedHostGroupsClientListBySubscriptionOptions contains the optional parameters for the DedicatedHostGroupsClient.NewListBySubscriptionPager // method. func (client *DedicatedHostGroupsClient) NewListBySubscriptionPager(options *DedicatedHostGroupsClientListBySubscriptionOptions) *runtime.Pager[DedicatedHostGroupsClientListBySubscriptionResponse] { @@ -326,7 +326,7 @@ func (client *DedicatedHostGroupsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,7 +344,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -385,7 +385,7 @@ func (client *DedicatedHostGroupsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go b/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go deleted file mode 100644 index e8e22e6c315a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhostgroups_client_example_test.go +++ /dev/null @@ -1,616 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.json -func ExampleDedicatedHostGroupsClient_CreateOrUpdate_createOrUpdateADedicatedHostGroupWithUltraSsdSupport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().CreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", armcompute.DedicatedHostGroup{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("finance"), - }, - Properties: &armcompute.DedicatedHostGroupProperties{ - AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{ - UltraSSDEnabled: to.Ptr(true), - }, - PlatformFaultDomainCount: to.Ptr[int32](3), - SupportAutomaticPlacement: to.Ptr(true), - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("finance"), - // "owner": to.Ptr("myCompany"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{ - // UltraSSDEnabled: to.Ptr(true), - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.json -func ExampleDedicatedHostGroupsClient_CreateOrUpdate_createOrUpdateADedicatedHostGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().CreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", armcompute.DedicatedHostGroup{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("finance"), - }, - Properties: &armcompute.DedicatedHostGroupProperties{ - PlatformFaultDomainCount: to.Ptr[int32](3), - SupportAutomaticPlacement: to.Ptr(true), - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("finance"), - // "owner": to.Ptr("myCompany"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroups_Update_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Update_dedicatedHostGroupsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().Update(ctx, "rgcompute", "aaaa", armcompute.DedicatedHostGroupUpdate{ - Tags: map[string]*string{ - "key9921": to.Ptr("aaaaaaaaaa"), - }, - Properties: &armcompute.DedicatedHostGroupProperties{ - InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - { - AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - { - Count: to.Ptr[float64](26), - VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - }}, - }, - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - }}, - }, - PlatformFaultDomainCount: to.Ptr[int32](3), - SupportAutomaticPlacement: to.Ptr(true), - }, - Zones: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("aaaa"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](26), - // VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroups_Update_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Update_dedicatedHostGroupsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.DedicatedHostGroupUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroups_Delete_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Delete_dedicatedHostGroupsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDedicatedHostGroupsClient().Delete(ctx, "rgcompute", "a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroups_Delete_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_Delete_dedicatedHostGroupsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDedicatedHostGroupsClient().Delete(ctx, "rgcompute", "aaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get.json -func ExampleDedicatedHostGroupsClient_Get_createADedicatedHostGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost1"), - // }, - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost2"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // Name: to.Ptr("myHost1"), - // }, - // { - // AssetID: to.Ptr("f293d4ac-5eea-4be2-b0c0-0fcaa09aebf8"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // Name: to.Ptr("myHost2"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.json -func ExampleDedicatedHostGroupsClient_Get_createAnUltraSsdEnabledDedicatedHostGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostGroupsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", &armcompute.DedicatedHostGroupsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHostGroup = armcompute.DedicatedHostGroup{ - // Name: to.Ptr("myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // AdditionalCapabilities: &armcompute.DedicatedHostGroupPropertiesAdditionalCapabilities{ - // UltraSSDEnabled: to.Ptr(true), - // }, - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myDedicatedHostGroup/myHostGroup/Hosts/myHost"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // Name: to.Ptr("myHost"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListByResourceGroup_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListByResourceGroupPager_dedicatedHostGroupsListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // Name: to.Ptr("myDedicatedHostGroup"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("aaaa"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](26), - // VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListByResourceGroup_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListByResourceGroupPager_dedicatedHostGroupsListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListBySubscription_MaximumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupsListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // Name: to.Ptr("myDedicatedHostGroup"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostGroupProperties{ - // Hosts: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // InstanceView: &armcompute.DedicatedHostGroupInstanceView{ - // Hosts: []*armcompute.DedicatedHostInstanceViewWithName{ - // { - // AssetID: to.Ptr("aaaa"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](26), - // VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // PlatformFaultDomainCount: to.Ptr[int32](3), - // SupportAutomaticPlacement: to.Ptr(true), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHostGroups_ListBySubscription_MinimumSet_Gen.json -func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupsListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostGroupsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{ - // Value: []*armcompute.DedicatedHostGroup{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go b/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go index e0331ac64f87..28c8742f37a7 100644 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go +++ b/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *DedicatedHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) if err != nil { @@ -110,7 +110,7 @@ func (client *DedicatedHostsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -119,7 +119,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - hostName - The name of the dedicated host. @@ -140,7 +140,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *DedicatedHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) if err != nil { @@ -180,7 +180,7 @@ func (client *DedicatedHostsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,7 +189,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - hostName - The name of the dedicated host. @@ -236,7 +236,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,10 +251,80 @@ func (client *DedicatedHostsClient) getHandleResponse(resp *http.Response) (Dedi return result, nil } +// 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-03-01 +// - resourceGroupName - The name of the resource group. +// - hostGroupName - The name of the dedicated host group. +// - hostName - The name of the dedicated host. +// - options - DedicatedHostsClientListAvailableSizesOptions contains the optional parameters for the DedicatedHostsClient.NewListAvailableSizesPager +// method. +func (client *DedicatedHostsClient) NewListAvailableSizesPager(resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientListAvailableSizesOptions) *runtime.Pager[DedicatedHostsClientListAvailableSizesResponse] { + return runtime.NewPager(runtime.PagingHandler[DedicatedHostsClientListAvailableSizesResponse]{ + More: func(page DedicatedHostsClientListAvailableSizesResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *DedicatedHostsClientListAvailableSizesResponse) (DedicatedHostsClientListAvailableSizesResponse, error) { + req, err := client.listAvailableSizesCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) + if err != nil { + return DedicatedHostsClientListAvailableSizesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DedicatedHostsClientListAvailableSizesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostsClientListAvailableSizesResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableSizesHandleResponse(resp) + }, + }) +} + +// listAvailableSizesCreateRequest creates the ListAvailableSizes request. +func (client *DedicatedHostsClient) listAvailableSizesCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientListAvailableSizesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/hostSizes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if hostName == "" { + return nil, errors.New("parameter hostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostName}", url.PathEscape(hostName)) + 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableSizesHandleResponse handles the ListAvailableSizes response. +func (client *DedicatedHostsClient) listAvailableSizesHandleResponse(resp *http.Response) (DedicatedHostsClientListAvailableSizesResponse, error) { + result := DedicatedHostsClientListAvailableSizesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostSizeListResult); err != nil { + return DedicatedHostsClientListAvailableSizesResponse{}, err + } + return result, nil +} + // 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 2022-11-01 +// Generated from API version 2023-03-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 @@ -307,7 +377,7 @@ func (client *DedicatedHostsClient) listByHostGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +398,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - hostName - The name of the dedicated host. @@ -352,7 +422,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *DedicatedHostsClient) restart(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) if err != nil { @@ -392,16 +462,16 @@ func (client *DedicatedHostsClient) restartCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// BeginUpdate - Update an dedicated host . +// BeginUpdate - Update a dedicated host . // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - hostGroupName - The name of the dedicated host group. // - hostName - The name of the dedicated host . @@ -420,10 +490,10 @@ func (client *DedicatedHostsClient) BeginUpdate(ctx context.Context, resourceGro } } -// Update - Update an dedicated host . +// Update - Update a dedicated host . // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 func (client *DedicatedHostsClient) update(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) if err != nil { @@ -463,7 +533,7 @@ func (client *DedicatedHostsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go b/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go deleted file mode 100644 index 0b1da4383a60..000000000000 --- a/sdk/resourcemanager/compute/armcompute/dedicatedhosts_client_example_test.go +++ /dev/null @@ -1,425 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.json -func ExampleDedicatedHostsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDedicatedHostGroup", "myDedicatedHost", armcompute.DedicatedHost{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "department": to.Ptr("HR"), - }, - Properties: &armcompute.DedicatedHostProperties{ - PlatformFaultDomain: to.Ptr[int32](1), - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("DSv3-Type1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Name: to.Ptr("myDedicatedHost"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(false), - // HostID: to.Ptr("{GUID}"), - // LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid), - // PlatformFaultDomain: to.Ptr[int32](1), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHosts_Update_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", armcompute.DedicatedHostUpdate{ - Tags: map[string]*string{ - "key8813": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }, - Properties: &armcompute.DedicatedHostProperties{ - AutoReplaceOnFailure: to.Ptr(true), - InstanceView: &armcompute.DedicatedHostInstanceView{ - AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - { - Count: to.Ptr[float64](26), - VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - }}, - }, - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - }, - LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid), - PlatformFaultDomain: to.Ptr[int32](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Name: to.Ptr("myDedicatedHost"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(true), - // HostID: to.Ptr("{GUID}"), - // InstanceView: &armcompute.DedicatedHostInstanceView{ - // AssetID: to.Ptr("aaaaaaaaaaaaaaaa"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](26), - // VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // }, - // LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid), - // PlatformFaultDomain: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()), - // VirtualMachines: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // Capacity: to.Ptr[int64](7), - // Tier: to.Ptr("aaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHosts_Update_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_BeginUpdate_dedicatedHostsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().BeginUpdate(ctx, "rgcompute", "aa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.DedicatedHostUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Location: to.Ptr("westus"), - // SKU: &armcompute.SKU{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHosts_Delete_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_BeginDelete_dedicatedHostsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().BeginDelete(ctx, "rgcompute", "aaaaaa", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHosts_Delete_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_BeginDelete_dedicatedHostsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaa", "aaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHost_Get.json -func ExampleDedicatedHostsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDedicatedHostsClient().Get(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", &armcompute.DedicatedHostsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DedicatedHost = armcompute.DedicatedHost{ - // Name: to.Ptr("myHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(true), - // HostID: to.Ptr("{GUID}"), - // InstanceView: &armcompute.DedicatedHostInstanceView{ - // AssetID: to.Ptr("eb3f58b8-b4e8-4882-b69f-301a01812407"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](10), - // VMSize: to.Ptr("Standard_A1"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // { - // Code: to.Ptr("HealthState/available"), - // DisplayStatus: to.Ptr("Host available"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // }, - // PlatformFaultDomain: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-27T01:02:38.3138469+00:00"); return t}()), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-27T01:02:38.3138469+00:00"); return t}()), - // VirtualMachines: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/vm1"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHosts_ListByHostGroup_MaximumSet_Gen.json -func ExampleDedicatedHostsClient_NewListByHostGroupPager_dedicatedHostsListByHostGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostsClient().NewListByHostGroupPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostListResult = armcompute.DedicatedHostListResult{ - // Value: []*armcompute.DedicatedHost{ - // { - // Name: to.Ptr("myDedicatedHost"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup/hosts/myDedicatedHost"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.DedicatedHostProperties{ - // AutoReplaceOnFailure: to.Ptr(true), - // HostID: to.Ptr("{GUID}"), - // InstanceView: &armcompute.DedicatedHostInstanceView{ - // AssetID: to.Ptr("aaaaaaaaaaaaaaaa"), - // AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{ - // AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{ - // { - // Count: to.Ptr[float64](26), - // VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // }, - // LicenseType: to.Ptr(armcompute.DedicatedHostLicenseTypesWindowsServerHybrid), - // PlatformFaultDomain: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProvisioningTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()), - // VirtualMachines: []*armcompute.SubResourceReadOnly{ - // { - // ID: to.Ptr("aaaa"), - // }}, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // Capacity: to.Ptr[int64](7), - // Tier: to.Ptr("aaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHosts_ListByHostGroup_MinimumSet_Gen.json -func ExampleDedicatedHostsClient_NewListByHostGroupPager_dedicatedHostsListByHostGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDedicatedHostsClient().NewListByHostGroupPager("rgcompute", "aaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DedicatedHostListResult = armcompute.DedicatedHostListResult{ - // Value: []*armcompute.DedicatedHost{ - // { - // Location: to.Ptr("westus"), - // SKU: &armcompute.SKU{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/dedicatedHostExamples/DedicatedHost_Restart.json -func ExampleDedicatedHostsClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDedicatedHostsClient().BeginRestart(ctx, "myResourceGroup", "myDedicatedHostGroup", "myHost", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go b/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go deleted file mode 100644 index 4432a81a6c30..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskaccesses_client_example_test.go +++ /dev/null @@ -1,529 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Create.json -func ExampleDiskAccessesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskAccess", armcompute.DiskAccess{ - Location: to.Ptr("West US"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourcegroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Update.json -func ExampleDiskAccessesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().BeginUpdate(ctx, "myResourceGroup", "myDiskAccess", armcompute.DiskAccessUpdate{ - Tags: map[string]*string{ - "department": to.Ptr("Development"), - "project": to.Ptr("PrivateEndpoints"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourcegroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json -func ExampleDiskAccessesClient_Get_getInformationAboutADiskAccessResourceWithPrivateEndpoints() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().Get(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Get.json -func ExampleDiskAccessesClient_Get_getInformationAboutADiskAccessResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().Get(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskAccess = armcompute.DiskAccess{ - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_Delete.json -func ExampleDiskAccessesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().BeginDelete(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_ListByResourceGroup.json -func ExampleDiskAccessesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskAccessesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskAccessList = armcompute.DiskAccessList{ - // Value: []*armcompute.DiskAccess{ - // { - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myDiskAccess2"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2/privateEndpoinConnections/myDiskAccess2.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint2"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccess_ListBySubscription.json -func ExampleDiskAccessesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskAccessesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskAccessList = armcompute.DiskAccessList{ - // Value: []*armcompute.DiskAccess{ - // { - // Name: to.Ptr("myDiskAccess"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myDiskAccess2"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("PrivateEndpoints"), - // }, - // Properties: &armcompute.DiskAccessProperties{ - // PrivateEndpointConnections: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myDiskAccess.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess2/privateEndpoinConnections/myDiskAccess2.d4914cfa-6bc2-4049-a57c-3d1f622d8eef"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint2"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T04:41:35.079872+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json -func ExampleDiskAccessesClient_GetPrivateLinkResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().GetPrivateLinkResources(ctx, "myResourceGroup", "myDiskAccess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResourceListResult = armcompute.PrivateLinkResourceListResult{ - // Value: []*armcompute.PrivateLinkResource{ - // { - // Name: to.Ptr("disks"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/privateLinkResources"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateLinkResources/disks"), - // Properties: &armcompute.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("disks"), - // RequiredMembers: []*string{ - // to.Ptr("diskAccess_1")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json -func ExampleDiskAccessesClient_BeginUpdateAPrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().BeginUpdateAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", armcompute.PrivateEndpointConnection{ - Properties: &armcompute.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approving myPrivateEndpointConnection"), - Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armcompute.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnectionName"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnectionName"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approving myPrivateEndpointConnection"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json -func ExampleDiskAccessesClient_GetAPrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskAccessesClient().GetAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armcompute.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnection"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json -func ExampleDiskAccessesClient_BeginDeleteAPrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskAccessesClient().BeginDeleteAPrivateEndpointConnection(ctx, "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json -func ExampleDiskAccessesClient_NewListPrivateEndpointConnectionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskAccessesClient().NewListPrivateEndpointConnectionsPager("myResourceGroup", "myDiskAccess", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armcompute.PrivateEndpointConnectionListResult{ - // Value: []*armcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Compute/diskAccesses/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/myDiskAccess/privateEndpoinConnections/myPrivateEndpointConnection"), - // Properties: &armcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcompute.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armcompute.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcompute.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcompute.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go b/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go deleted file mode 100644 index 4875c39823c6..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskencryptionsets_client_example_test.go +++ /dev/null @@ -1,657 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.json -func ExampleDiskEncryptionSetsClient_BeginCreateOrUpdate_createADiskEncryptionSetWithKeyVaultFromADifferentSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{ - Location: to.Ptr("West US"), - Identity: &armcompute.EncryptionSetIdentity{ - Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - }, - Properties: &armcompute.EncryptionSetProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}"), - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Location: to.Ptr("West US"), - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}"), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.json -func ExampleDiskEncryptionSetsClient_BeginCreateOrUpdate_createADiskEncryptionSetWithKeyVaultFromADifferentTenant() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{ - Location: to.Ptr("West US"), - Identity: &armcompute.EncryptionSetIdentity{ - Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}": {}, - }, - }, - Properties: &armcompute.EncryptionSetProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvaultdifferenttenant.vault-int.azure-int.net/keys/{key}"), - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - FederatedClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Location: to.Ptr("West US"), - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}": &armcompute.UserAssignedIdentitiesValue{ - // }, - // }, - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvaultdifferenttenant.vault-int.azure-int.net/keys/{key}"), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // FederatedClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create.json -func ExampleDiskEncryptionSetsClient_BeginCreateOrUpdate_createADiskEncryptionSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSet{ - Location: to.Ptr("West US"), - Identity: &armcompute.EncryptionSetIdentity{ - Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - }, - Properties: &armcompute.EncryptionSetProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - SourceVault: &armcompute.SourceVault{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - }, - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Location: to.Ptr("West US"), - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.json -func ExampleDiskEncryptionSetsClient_BeginUpdate_updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{ - Identity: &armcompute.EncryptionSetIdentity{ - Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - }, - Properties: &armcompute.DiskEncryptionSetUpdateProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"), - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - RotationToLatestKeyVersionEnabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("West US"), - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/KeyVersion2"), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079872+00:00"); return t}()), - // ProvisioningState: to.Ptr("Succeeded"), - // RotationToLatestKeyVersionEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.json -func ExampleDiskEncryptionSetsClient_BeginUpdate_updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{ - Identity: &armcompute.EncryptionSetIdentity{ - Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - }, - Properties: &armcompute.DiskEncryptionSetUpdateProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"), - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - RotationToLatestKeyVersionEnabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("West US"), - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion2"), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079872+00:00"); return t}()), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // { - // KeyURL: to.Ptr("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RotationToLatestKeyVersionEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update.json -func ExampleDiskEncryptionSetsClient_BeginUpdate_updateADiskEncryptionSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginUpdate(ctx, "myResourceGroup", "myDiskEncryptionSet", armcompute.DiskEncryptionSetUpdate{ - Properties: &armcompute.DiskEncryptionSetUpdateProperties{ - ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion"), - SourceVault: &armcompute.SourceVault{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - }, - }, - EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - }, - Tags: map[string]*string{ - "department": to.Ptr("Development"), - "project": to.Ptr("Encryption"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // LastKeyRotationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T04:41:35.079872+00:00"); return t}()), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json -func ExampleDiskEncryptionSetsClient_Get_getInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskEncryptionSetsClient().Get(ctx, "myResourceGroup", "myDiskEncryptionSet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // AutoKeyRotationError: &armcompute.APIError{ - // Code: to.Ptr("ManagedServiceIdentityNotFound"), - // Message: to.Ptr("Auto-key rotation was disabled as managed service identity associated with DiskEncryptionSet 'myDiskEncryptionSet' was not found. Please update the resource with correct identity to re-enable auto-key rotation."), - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // RotationToLatestKeyVersionEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get.json -func ExampleDiskEncryptionSetsClient_Get_getInformationAboutADiskEncryptionSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskEncryptionSetsClient().Get(ctx, "myResourceGroup", "myDiskEncryptionSet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskEncryptionSet = armcompute.DiskEncryptionSet{ - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json -func ExampleDiskEncryptionSetsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskEncryptionSetsClient().BeginDelete(ctx, "myResourceGroup", "myDiskEncryptionSet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json -func ExampleDiskEncryptionSetsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskEncryptionSetsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskEncryptionSetList = armcompute.DiskEncryptionSetList{ - // Value: []*armcompute.DiskEncryptionSet{ - // { - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("myDiskEncryptionSet2"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault2"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json -func ExampleDiskEncryptionSetsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskEncryptionSetsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskEncryptionSetList = armcompute.DiskEncryptionSetList{ - // Value: []*armcompute.DiskEncryptionSet{ - // { - // Name: to.Ptr("myDiskEncryptionSet"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("myDiskEncryptionSet2"), - // Type: to.Ptr("Microsoft.Compute/diskEncryptionSets"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/mySecondResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/myDiskEncryptionSet2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Encryption"), - // }, - // Identity: &armcompute.EncryptionSetIdentity{ - // Type: to.Ptr(armcompute.DiskEncryptionSetIdentityTypeSystemAssigned), - // }, - // Properties: &armcompute.EncryptionSetProperties{ - // ActiveKey: &armcompute.KeyForDiskEncryptionSet{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/mySecondResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault2"), - // }, - // }, - // EncryptionType: to.Ptr(armcompute.DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey), - // PreviousKeys: []*armcompute.KeyForDiskEncryptionSet{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json -func ExampleDiskEncryptionSetsClient_NewListAssociatedResourcesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskEncryptionSetsClient().NewListAssociatedResourcesPager("myResourceGroup", "myDiskEncryptionSet", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceURIList = armcompute.ResourceURIList{ - // Value: []*string{ - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go b/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go deleted file mode 100644 index 482181ef1b17..000000000000 --- a/sdk/resourcemanager/compute/armcompute/diskrestorepoint_client_example_test.go +++ /dev/null @@ -1,183 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_Get.json -func ExampleDiskRestorePointClient_Get_getAnIncrementalDiskRestorePointResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskRestorePointClient().Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskRestorePoint = armcompute.DiskRestorePoint{ - // Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // Properties: &armcompute.DiskRestorePointProperties{ - // FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled), - // SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"), - // SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json -func ExampleDiskRestorePointClient_Get_getAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiskRestorePointClient().Get(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiskRestorePoint = armcompute.DiskRestorePoint{ - // Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // Properties: &armcompute.DiskRestorePointProperties{ - // CompletionPercent: to.Ptr[float32](100), - // FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled), - // ReplicationState: to.Ptr("Succeeded"), - // SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"), - // SourceResourceLocation: to.Ptr("eastus2"), - // SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json -func ExampleDiskRestorePointClient_NewListByRestorePointPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiskRestorePointClient().NewListByRestorePointPager("myResourceGroup", "rpc", "vmrp", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskRestorePointList = armcompute.DiskRestorePointList{ - // Value: []*armcompute.DiskRestorePoint{ - // { - // Name: to.Ptr("TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpc/restorePoints/vmrp/diskRestorePoints/TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745"), - // Properties: &armcompute.DiskRestorePointProperties{ - // FamilyID: to.Ptr("996bf3ce-b6ff-4e86-9db6-dc27ea06cea5"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessDisabled), - // SourceResourceID: to.Ptr("/subscriptions/d2260d06-e00d-422f-8b63-93df551a59ae/resourceGroups/rg0680fb0c-89f1-41b4-96c0-35733a181558/providers/Microsoft.Compute/disks/TestDisk45ceb03433006d1baee0"), - // SourceUniqueID: to.Ptr("48e058b1-7eea-4968-b532-10a8a1130c13"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-16T04:41:35.079872+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json -func ExampleDiskRestorePointClient_BeginGrantAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskRestorePointClient().BeginGrantAccess(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json -func ExampleDiskRestorePointClient_BeginRevokeAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDiskRestorePointClient().BeginRevokeAccess(ctx, "myResourceGroup", "rpc", "vmrp", "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go b/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go deleted file mode 100644 index f4a335f7cb2e..000000000000 --- a/sdk/resourcemanager/compute/armcompute/disks_client_example_test.go +++ /dev/null @@ -1,2115 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json -func ExampleDisksClient_BeginCreateOrUpdate_createAConfidentialVmSupportedDiskEncryptedWithCustomerManagedKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - ImageReference: &armcompute.ImageDiskReference{ - ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - SecurityProfile: &armcompute.DiskSecurityProfile{ - SecureVMDiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), - SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"), - // }, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecureVMDiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"), - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithDiskAccess.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskAndAssociateWithDiskAccessResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskAccessID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"), - DiskSizeGB: to.Ptr[int32](200), - NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowPrivate), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskAccessID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"), - // DiskSizeGB: to.Ptr[int32](200), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowPrivate), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithDiskEncryptionSet.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskAndAssociateWithDiskEncryptionSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - Encryption: &armcompute.Encryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ByCopyingASnapshot.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByCopyingASnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - // SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - // SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromImportSecure.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromImportSecureCreateOption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionImportSecure), - SecurityDataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"), - SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - SecurityProfile: &armcompute.DiskSecurityProfile{ - SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionImportSecure), - // SecurityDataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"), - // SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromUploadPreparedSecure.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromUploadPreparedSecureCreateOption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionUploadPreparedSecure), - UploadSizeBytes: to.Ptr[int64](10737418752), - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - SecurityProfile: &armcompute.DiskSecurityProfile{ - SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionUploadPreparedSecure), - // UploadSizeBytes: to.Ptr[int64](10737418752), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAPlatformImage.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAPlatformImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - ImageReference: &armcompute.ImageDiskReference{ - ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("{sku}"), - // Product: to.Ptr("{offer}"), - // Publisher: to.Ptr("{publisher}"), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryCommunityImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - GalleryImageReference: &armcompute.ImageDiskReference{ - CommunityGalleryImageID: to.Ptr("/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // GalleryImageReference: &armcompute.ImageDiskReference{ - // CommunityGalleryImageID: to.Ptr("/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryDirectSharedImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - GalleryImageReference: &armcompute.ImageDiskReference{ - SharedGalleryImageID: to.Ptr("/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // GalleryImageReference: &armcompute.ImageDiskReference{ - // SharedGalleryImageID: to.Ptr("/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - GalleryImageReference: &armcompute.ImageDiskReference{ - ID: to.Ptr("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // GalleryImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"), - // }, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_FromAnExistingManagedDisk.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk2", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk2"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithDataAccessAuthMode.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithDataAccessAuthMode() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DataAccessAuthMode: to.Ptr(armcompute.DataAccessAuthModeAzureActiveDirectory), - DiskSizeGB: to.Ptr[int32](200), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DataAccessAuthMode: to.Ptr(armcompute.DataAccessAuthModeAzureActiveDirectory), - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithOptimizedForFrequentAttach() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - OptimizedForFrequentAttach: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // OptimizedForFrequentAttach: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_PerformancePlus.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithPerformancePlus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload), - PerformancePlus: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload), - // PerformancePlus: to.Ptr(true), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithPremiumV2AccountType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myPremiumV2Disk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskIOPSReadWrite: to.Ptr[int64](125), - DiskMBpsReadWrite: to.Ptr[int64](3000), - DiskSizeGB: to.Ptr[int32](200), - }, - SKU: &armcompute.DiskSKU{ - Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumV2LRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myPremiumV2Disk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumV2LRS), - // Tier: to.Ptr("Premium"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithSecurityProfile.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithSecurityProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("North Central US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - ImageReference: &armcompute.ImageDiskReference{ - ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"), - }, - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - SecurityProfile: &armcompute.DiskSecurityProfile{ - SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("North Central US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"), - // }, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithSSDZRSAccountType.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithSsdZrsAccountType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - }, - SKU: &armcompute.DiskSKU{ - Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumZRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumZRS), - // Tier: to.Ptr("Premium"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myUltraReadOnlyDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - LogicalSectorSize: to.Ptr[int32](4096), - }, - DiskIOPSReadWrite: to.Ptr[int64](125), - DiskMBpsReadWrite: to.Ptr[int64](3000), - DiskSizeGB: to.Ptr[int32](200), - Encryption: &armcompute.Encryption{ - Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - }, - }, - SKU: &armcompute.DiskSKU{ - Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myUltraReadOnlyDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS), - // Tier: to.Ptr("Ultra"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_UploadDisk.json -func ExampleDisksClient_BeginCreateOrUpdate_createAManagedUploadDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload), - UploadSizeBytes: to.Ptr[int64](10737418752), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload), - // UploadSizeBytes: to.Ptr[int64](10737418752), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_InExtendedLocation.json -func ExampleDisksClient_BeginCreateOrUpdate_createAnEmptyManagedDiskInExtendedLocation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - ExtendedLocation: &armcompute.ExtendedLocation{ - Name: to.Ptr("{edge-zone-id}"), - Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - }, - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("{edge-zone-id}"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_Empty.json -func ExampleDisksClient_BeginCreateOrUpdate_createAnEmptyManagedDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - }, - DiskSizeGB: to.Ptr[int32](200), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Create_WithLogicalSectorSize.json -func ExampleDisksClient_BeginCreateOrUpdate_createAnUltraManagedDiskWithLogicalSectorSize512E() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{ - Location: to.Ptr("West US"), - Properties: &armcompute.DiskProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - LogicalSectorSize: to.Ptr[int32](512), - }, - DiskSizeGB: to.Ptr[int32](200), - }, - SKU: &armcompute.DiskSKU{ - Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // LogicalSectorSize: to.Ptr[int32](512), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS), - // Tier: to.Ptr("Ultra"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json -func ExampleDisksClient_BeginUpdate_createOrUpdateABurstingEnabledManagedDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - BurstingEnabled: to.Ptr(true), - DiskSizeGB: to.Ptr[int32](1024), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // BurstingEnabled: to.Ptr(true), - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](1024), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddAcceleratedNetworking.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddAcceleratedNetworking() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - SupportedCapabilities: &armcompute.SupportedCapabilities{ - AcceleratedNetwork: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(false), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_ToAddArchitecture.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddArchitecture() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - SupportedCapabilities: &armcompute.SupportedCapabilities{ - Architecture: to.Ptr(armcompute.ArchitectureArm64), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // Architecture: to.Ptr(armcompute.ArchitectureArm64), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddPurchasePlan.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddPurchasePlan() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - PurchasePlan: &armcompute.DiskPurchasePlan{ - Name: to.Ptr("myPurchasePlanName"), - Product: to.Ptr("myPurchasePlanProduct"), - PromotionCode: to.Ptr("myPurchasePlanPromotionCode"), - Publisher: to.Ptr("myPurchasePlanPublisher"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("myPurchasePlanName"), - // Product: to.Ptr("myPurchasePlanProduct"), - // PromotionCode: to.Ptr("myPurchasePlanPromotionCode"), - // Publisher: to.Ptr("myPurchasePlanPublisher"), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddSupportsHibernation.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddSupportsHibernation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - SupportsHibernation: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - // SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportsHibernation: to.Ptr(true), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_ChangeTier.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToChangeTier() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - Tier: to.Ptr("P30"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Tier: to.Ptr("P30"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_DisableBursting.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToDisableBursting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - BurstingEnabled: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskToDisableOptimizedForFrequentAttach() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - OptimizedForFrequentAttach: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // OptimizedForFrequentAttach: to.Ptr(false), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_AddDiskControllerTypes.json -func ExampleDisksClient_BeginUpdate_updateAManagedDiskWithDiskControllerTypes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - SupportedCapabilities: &armcompute.SupportedCapabilities{ - DiskControllerTypes: to.Ptr("SCSI"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/marketplacetestfirstparty/ArtifactTypes/VMImage/Offers/nvme_test_062/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](127), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // DiskControllerTypes: to.Ptr("SCSI"), - // }, - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Update_RemoveDiskAccess.json -func ExampleDisksClient_BeginUpdate_updateManagedDiskToRemoveDiskAccessResourceAssociation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{ - Properties: &armcompute.DiskUpdateProperties{ - NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myDisk"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Get.json -func ExampleDisksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDisksClient().Get(ctx, "myResourceGroup", "myManagedDisk", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Disk = armcompute.Disk{ - // Name: to.Ptr("myManagedDisk"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // ManagedBy: to.Ptr("/subscriptions/123caaa-123v-v211-a49f-f88ccac5bf88/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/virtualMachines/TestVM414689371c88843d65ec"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](10), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // }}, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("test_sku"), - // Product: to.Ptr("marketplace_vm_test"), - // Publisher: to.Ptr("test_test_pmc2pc1"), - // }, - // SecurityProfile: &armcompute.DiskSecurityProfile{ - // SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // SupportsHibernation: to.Ptr(true), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079872+00:00"); return t}()), - // }, - // SKU: &armcompute.DiskSKU{ - // Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_Delete.json -func ExampleDisksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginDelete(ctx, "myResourceGroup", "myDisk", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_ListByResourceGroup.json -func ExampleDisksClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDisksClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskList = armcompute.DiskList{ - // Value: []*armcompute.Disk{ - // { - // Name: to.Ptr("myManagedDisk1"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.9278721+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk2"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](10), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.872242+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk3"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.3973934+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_ListBySubscription.json -func ExampleDisksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDisksClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DiskList = armcompute.DiskList{ - // Value: []*armcompute.Disk{ - // { - // Name: to.Ptr("myManagedDisk1"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.9278721+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk2"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty), - // }, - // DiskSizeGB: to.Ptr[int32](10), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.872242+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("myManagedDisk3"), - // Type: to.Ptr("Microsoft.Compute/disks"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk3"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("ManagedDisks"), - // }, - // Properties: &armcompute.DiskProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage), - // ImageReference: &armcompute.ImageDiskReference{ - // ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"), - // }, - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:36.3973934+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_BeginGetAccess.json -func ExampleDisksClient_BeginGrantAccess_getASasOnAManagedDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginGrantAccess(ctx, "myResourceGroup", "myDisk", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_BeginGetAccess_WithVMGuestState.json -func ExampleDisksClient_BeginGrantAccess_getSasOnManagedDiskAndVmGuestState() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginGrantAccess(ctx, "myResourceGroup", "myDisk", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - GetSecureVMGuestStateSAS: to.Ptr(true), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // SecurityDataAccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/b9bf5824-6122-49e0-ba22-042f76ccd8a1_vmgs?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/diskExamples/Disk_EndGetAccess.json -func ExampleDisksClient_BeginRevokeAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDisksClient().BeginRevokeAccess(ctx, "myResourceGroup", "myDisk", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go deleted file mode 100644 index 913b1ce36fe2..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleries_client_example_test.go +++ /dev/null @@ -1,521 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/CommunityGallery_Create.json -func ExampleGalleriesClient_BeginCreateOrUpdate_createACommunityGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - SharingProfile: &armcompute.SharingProfile{ - CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{ - Eula: to.Ptr("eula"), - PublicNamePrefix: to.Ptr("PirPublic"), - PublisherContact: to.Ptr("pir@microsoft.com"), - PublisherURI: to.Ptr("uri"), - }, - Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // SharingProfile: &armcompute.SharingProfile{ - // CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{ - // Eula: to.Ptr("eula"), - // PublicNamePrefix: to.Ptr("PirPublic"), - // PublisherContact: to.Ptr("pir@microsoft.com"), - // PublisherURI: to.Ptr("uri"), - // }, - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Create_WithSharingProfile.json -func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryWithSharingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - SharingProfile: &armcompute.SharingProfile{ - Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // SharingProfile: &armcompute.SharingProfile{ - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Create_SoftDeletionEnabled.json -func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryWithSoftDeletionEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - SoftDeletePolicy: &armcompute.SoftDeletePolicy{ - IsSoftDeleteEnabled: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // SoftDeletePolicy: &armcompute.SoftDeletePolicy{ - // IsSoftDeleteEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Create.json -func ExampleGalleriesClient_BeginCreateOrUpdate_createOrUpdateASimpleGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.Gallery{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Update.json -func ExampleGalleriesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.GalleryUpdate{ - Properties: &armcompute.GalleryProperties{ - Description: to.Ptr("This is the gallery description."), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/CommunityGallery_Get.json -func ExampleGalleriesClient_Get_getACommunityGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // SharingProfile: &armcompute.SharingProfile{ - // CommunityGalleryInfo: &armcompute.CommunityGalleryInfo{ - // CommunityGalleryEnabled: to.Ptr(true), - // Eula: to.Ptr("eula"), - // PublicNames: []*string{ - // to.Ptr("GalelryPublicName")}, - // PublisherContact: to.Ptr("pir@microsoft.com"), - // PublisherURI: to.Ptr("uri"), - // }, - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesCommunity), - // }, - // SharingStatus: &armcompute.SharingStatus{ - // AggregatedState: to.Ptr(armcompute.SharingStateSucceeded), - // Summary: []*armcompute.RegionalSharingStatus{ - // { - // Region: to.Ptr("westus"), - // State: to.Ptr(armcompute.SharingStateSucceeded), - // Details: to.Ptr(""), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json -func ExampleGalleriesClient_Get_getAGalleryWithExpandSharingProfileGroups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: to.Ptr(armcompute.GalleryExpandParamsSharingProfileGroups), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // SharingProfile: &armcompute.SharingProfile{ - // Groups: []*armcompute.SharingProfileGroup{ - // { - // Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions), - // IDs: []*string{ - // to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"), - // to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")}, - // }, - // { - // Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants), - // IDs: []*string{ - // to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")}, - // }}, - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get_WithSelectPermissions.json -func ExampleGalleriesClient_Get_getAGalleryWithSelectPermissions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: to.Ptr(armcompute.SelectPermissionsPermissions), - Expand: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // SharingProfile: &armcompute.SharingProfile{ - // Groups: []*armcompute.SharingProfileGroup{ - // { - // Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions), - // IDs: []*string{ - // to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"), - // to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")}, - // }, - // { - // Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants), - // IDs: []*string{ - // to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")}, - // }}, - // Permissions: to.Ptr(armcompute.GallerySharingPermissionTypesGroups), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Get.json -func ExampleGalleriesClient_Get_getAGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().Get(ctx, "myResourceGroup", "myGalleryName", &armcompute.GalleriesClientGetOptions{Select: nil, - Expand: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armcompute.Gallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_Delete.json -func ExampleGalleriesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_ListByResourceGroup.json -func ExampleGalleriesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleriesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryList = armcompute.GalleryList{ - // Value: []*armcompute.Gallery{ - // { - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_ListBySubscription.json -func ExampleGalleriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleriesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryList = armcompute.GalleryList{ - // Value: []*armcompute.Gallery{ - // { - // Name: to.Ptr("myGalleryName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryProperties{ - // Description: to.Ptr("This is the gallery description."), - // Identifier: &armcompute.GalleryIdentifier{ - // UniqueName: to.Ptr("{subscription-id}-MYGALLERYNAME"), - // }, - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go deleted file mode 100644 index a89242a2061d..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryapplications_client_example_test.go +++ /dev/null @@ -1,285 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Create.json -func ExampleGalleryApplicationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", armcompute.GalleryApplication{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryApplicationProperties{ - Description: to.Ptr("This is the gallery application description."), - CustomActions: []*armcompute.GalleryApplicationCustomAction{ - { - Name: to.Ptr("myCustomAction"), - Description: to.Ptr("This is the custom action description."), - Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - { - Name: to.Ptr("myCustomActionParameter"), - Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - Description: to.Ptr("This is the description of the parameter"), - DefaultValue: to.Ptr("default value of parameter."), - Required: to.Ptr(false), - }}, - Script: to.Ptr("myCustomActionScript"), - }}, - Eula: to.Ptr("This is the gallery application EULA."), - PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"), - ReleaseNoteURI: to.Ptr("myReleaseNoteUri"), - SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplication = armcompute.GalleryApplication{ - // Name: to.Ptr("myGalleryApplicationName"), - // Type: to.Ptr("Microsoft.Compute/galleries"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationProperties{ - // Description: to.Ptr("This is the gallery application description."), - // CustomActions: []*armcompute.GalleryApplicationCustomAction{ - // { - // Name: to.Ptr("myCustomAction"), - // Description: to.Ptr("This is the custom action description."), - // Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - // { - // Name: to.Ptr("myCustomActionParameter"), - // Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - // Description: to.Ptr("This is the description of the parameter"), - // DefaultValue: to.Ptr("default value of parameter."), - // Required: to.Ptr(false), - // }}, - // Script: to.Ptr("myCustomActionScript"), - // }}, - // Eula: to.Ptr("This is the gallery application EULA."), - // PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"), - // ReleaseNoteURI: to.Ptr("myReleaseNoteUri"), - // SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Update.json -func ExampleGalleryApplicationsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", armcompute.GalleryApplicationUpdate{ - Properties: &armcompute.GalleryApplicationProperties{ - Description: to.Ptr("This is the gallery application description."), - CustomActions: []*armcompute.GalleryApplicationCustomAction{ - { - Name: to.Ptr("myCustomAction"), - Description: to.Ptr("This is the custom action description."), - Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - { - Name: to.Ptr("myCustomActionParameter"), - Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - Description: to.Ptr("This is the description of the parameter"), - DefaultValue: to.Ptr("default value of parameter."), - Required: to.Ptr(false), - }}, - Script: to.Ptr("myCustomActionScript"), - }}, - Eula: to.Ptr("This is the gallery application EULA."), - PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"), - ReleaseNoteURI: to.Ptr("myReleaseNoteUri"), - SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplication = armcompute.GalleryApplication{ - // Name: to.Ptr("myGalleryApplicationName"), - // Type: to.Ptr("Microsoft.Compute/galleries"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationProperties{ - // Description: to.Ptr("This is the gallery application description."), - // CustomActions: []*armcompute.GalleryApplicationCustomAction{ - // { - // Name: to.Ptr("myCustomAction"), - // Description: to.Ptr("This is the custom action description."), - // Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - // { - // Name: to.Ptr("myCustomActionParameter"), - // Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - // Description: to.Ptr("This is the description of the parameter"), - // DefaultValue: to.Ptr("default value of parameter."), - // Required: to.Ptr(false), - // }}, - // Script: to.Ptr("myCustomActionScript"), - // }}, - // Eula: to.Ptr("This is the gallery application EULA."), - // PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"), - // ReleaseNoteURI: to.Ptr("myReleaseNoteUri"), - // SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Get.json -func ExampleGalleryApplicationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryApplicationsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplication = armcompute.GalleryApplication{ - // Name: to.Ptr("myGalleryApplicationName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationProperties{ - // Description: to.Ptr("This is the gallery application description."), - // CustomActions: []*armcompute.GalleryApplicationCustomAction{ - // { - // Name: to.Ptr("myCustomAction"), - // Description: to.Ptr("This is the custom action description."), - // Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - // { - // Name: to.Ptr("myCustomActionParameter"), - // Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - // Description: to.Ptr("This is the description of the parameter"), - // DefaultValue: to.Ptr("default value of parameter."), - // Required: to.Ptr(false), - // }}, - // Script: to.Ptr("myCustomActionScript"), - // }}, - // Eula: to.Ptr("This is the gallery application EULA."), - // PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"), - // ReleaseNoteURI: to.Ptr("myReleaseNoteUri"), - // SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_Delete.json -func ExampleGalleryApplicationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationsClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplication_ListByGallery.json -func ExampleGalleryApplicationsClient_NewListByGalleryPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryApplicationsClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryApplicationList = armcompute.GalleryApplicationList{ - // Value: []*armcompute.GalleryApplication{ - // { - // Name: to.Ptr("myGalleryApplicationName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationProperties{ - // Description: to.Ptr("This is the gallery application description."), - // CustomActions: []*armcompute.GalleryApplicationCustomAction{ - // { - // Name: to.Ptr("myCustomAction"), - // Description: to.Ptr("This is the custom action description."), - // Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - // { - // Name: to.Ptr("myCustomActionParameter"), - // Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - // Description: to.Ptr("This is the description of the parameter"), - // DefaultValue: to.Ptr("default value of parameter."), - // Required: to.Ptr(false), - // }}, - // Script: to.Ptr("myCustomActionScript"), - // }}, - // Eula: to.Ptr("This is the gallery application EULA."), - // PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"), - // ReleaseNoteURI: to.Ptr("myReleaseNoteUri"), - // SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go deleted file mode 100644 index aebacdd761f8..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryapplicationversions_client_example_test.go +++ /dev/null @@ -1,473 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Create.json -func ExampleGalleryApplicationVersionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", armcompute.GalleryApplicationVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryApplicationVersionProperties{ - PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00Z"); return t }()), - ReplicaCount: to.Ptr[int32](1), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - }}, - CustomActions: []*armcompute.GalleryApplicationCustomAction{ - { - Name: to.Ptr("myCustomAction"), - Description: to.Ptr("This is the custom action description."), - Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - { - Name: to.Ptr("myCustomActionParameter"), - Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - Description: to.Ptr("This is the description of the parameter"), - DefaultValue: to.Ptr("default value of parameter."), - Required: to.Ptr(false), - }}, - Script: to.Ptr("myCustomActionScript"), - }}, - ManageActions: &armcompute.UserArtifactManage{ - Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - Remove: to.Ptr("del C:\\package "), - }, - Source: &armcompute.UserArtifactSource{ - MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - }, - }, - SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00+00:00"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.5972568+00:00"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // AdvancedSettings: map[string]*string{ - // "timeout": to.Ptr("300"), - // "user": to.Ptr("root"), - // }, - // CustomActions: []*armcompute.GalleryApplicationCustomAction{ - // { - // Name: to.Ptr("myCustomAction"), - // Description: to.Ptr("This is the custom action description."), - // Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - // { - // Name: to.Ptr("myCustomActionParameter"), - // Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - // Description: to.Ptr("This is the description of the parameter"), - // DefaultValue: to.Ptr("default value of parameter."), - // Required: to.Ptr(false), - // }}, - // Script: to.Ptr("myCustomActionScript"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // ManageActions: &armcompute.UserArtifactManage{ - // Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - // Remove: to.Ptr("del C:\\package "), - // }, - // Settings: &armcompute.UserArtifactSettings{ - // ConfigFileName: to.Ptr("configuration.cfg"), - // PackageFileName: to.Ptr("package.zip"), - // }, - // Source: &armcompute.UserArtifactSource{ - // MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - // }, - // }, - // SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Update.json -func ExampleGalleryApplicationVersionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationVersionsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", armcompute.GalleryApplicationVersionUpdate{ - Properties: &armcompute.GalleryApplicationVersionProperties{ - PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00Z"); return t }()), - ReplicaCount: to.Ptr[int32](1), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - }}, - ManageActions: &armcompute.UserArtifactManage{ - Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - Remove: to.Ptr("del C:\\package "), - }, - Source: &armcompute.UserArtifactSource{ - MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - }, - }, - SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00+00:00"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.5972568+00:00"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // EnableHealthCheck: to.Ptr(false), - // ManageActions: &armcompute.UserArtifactManage{ - // Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - // Remove: to.Ptr("del C:\\package "), - // }, - // Source: &armcompute.UserArtifactSource{ - // MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - // }, - // }, - // SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.json -func ExampleGalleryApplicationVersionsClient_Get_getAGalleryApplicationVersionWithReplicationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryApplicationVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", &armcompute.GalleryApplicationVersionsClientGetOptions{Expand: to.Ptr(armcompute.ReplicationStatusTypesReplicationStatus)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00+00:00"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.5972568+00:00"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // AdvancedSettings: map[string]*string{ - // "timeout": to.Ptr("300"), - // "user": to.Ptr("root"), - // }, - // CustomActions: []*armcompute.GalleryApplicationCustomAction{ - // { - // Name: to.Ptr("myCustomAction"), - // Description: to.Ptr("This is the custom action description."), - // Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - // { - // Name: to.Ptr("myCustomActionParameter"), - // Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - // Description: to.Ptr("This is the description of the parameter"), - // DefaultValue: to.Ptr("default value of parameter."), - // Required: to.Ptr(false), - // }}, - // Script: to.Ptr("myCustomActionScript"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // ManageActions: &armcompute.UserArtifactManage{ - // Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - // Remove: to.Ptr("del C:\\package "), - // }, - // Settings: &armcompute.UserArtifactSettings{ - // ConfigFileName: to.Ptr("configuration.cfg"), - // PackageFileName: to.Ptr("package.zip"), - // }, - // Source: &armcompute.UserArtifactSource{ - // MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - // }, - // }, - // ReplicationStatus: &armcompute.ReplicationStatus{ - // AggregatedState: to.Ptr(armcompute.AggregatedReplicationStateCompleted), - // Summary: []*armcompute.RegionalReplicationStatus{ - // { - // Progress: to.Ptr[int32](100), - // Region: to.Ptr("West US"), - // State: to.Ptr(armcompute.ReplicationStateCompleted), - // Details: to.Ptr(""), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Get.json -func ExampleGalleryApplicationVersionsClient_Get_getAGalleryApplicationVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryApplicationVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", &armcompute.GalleryApplicationVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryApplicationVersion = armcompute.GalleryApplicationVersion{ - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00+00:00"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.5972568+00:00"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // CustomActions: []*armcompute.GalleryApplicationCustomAction{ - // { - // Name: to.Ptr("myCustomAction"), - // Description: to.Ptr("This is the custom action description."), - // Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - // { - // Name: to.Ptr("myCustomActionParameter"), - // Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - // Description: to.Ptr("This is the description of the parameter"), - // DefaultValue: to.Ptr("default value of parameter."), - // Required: to.Ptr(false), - // }}, - // Script: to.Ptr("myCustomActionScript"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // ManageActions: &armcompute.UserArtifactManage{ - // Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - // Remove: to.Ptr("del C:\\package "), - // }, - // Source: &armcompute.UserArtifactSource{ - // MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - // }, - // }, - // SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_Delete.json -func ExampleGalleryApplicationVersionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryApplicationVersionsClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.json -func ExampleGalleryApplicationVersionsClient_NewListByGalleryApplicationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryApplicationVersionsClient().NewListByGalleryApplicationPager("myResourceGroup", "myGalleryName", "myGalleryApplicationName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryApplicationVersionList = armcompute.GalleryApplicationVersionList{ - // Value: []*armcompute.GalleryApplicationVersion{ - // { - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.Compute/galleries/applications/versions"), - // ID: to.Ptr("/subscriptions/01523d7c-60da-455e-adef-521b547922c4/resourceGroups/galleryPsTestRg98/providers/Microsoft.Compute/galleries/galleryPsTestGallery6165/applications/galleryPsTestGalleryApplication7825/versions/1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryApplicationVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryApplicationVersionPublishingProfile{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T07:00:00+00:00"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-21T17:13:57.5972568+00:00"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // CustomActions: []*armcompute.GalleryApplicationCustomAction{ - // { - // Name: to.Ptr("myCustomAction"), - // Description: to.Ptr("This is the custom action description."), - // Parameters: []*armcompute.GalleryApplicationCustomActionParameter{ - // { - // Name: to.Ptr("myCustomActionParameter"), - // Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString), - // Description: to.Ptr("This is the description of the parameter"), - // DefaultValue: to.Ptr("default value of parameter."), - // Required: to.Ptr(false), - // }}, - // Script: to.Ptr("myCustomActionScript"), - // }}, - // EnableHealthCheck: to.Ptr(false), - // ManageActions: &armcompute.UserArtifactManage{ - // Install: to.Ptr("powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\""), - // Remove: to.Ptr("del C:\\package "), - // }, - // Source: &armcompute.UserArtifactSource{ - // MediaLink: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}"), - // }, - // }, - // SafetyProfile: &armcompute.GalleryApplicationVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go deleted file mode 100644 index 9782c9ae922a..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryimages_client_example_test.go +++ /dev/null @@ -1,219 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Create.json -func ExampleGalleryImagesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", armcompute.GalleryImage{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageProperties{ - HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - Identifier: &armcompute.GalleryImageIdentifier{ - Offer: to.Ptr("myOfferName"), - Publisher: to.Ptr("myPublisherName"), - SKU: to.Ptr("mySkuName"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImage = armcompute.GalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageProperties{ - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Identifier: &armcompute.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Update.json -func ExampleGalleryImagesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", armcompute.GalleryImageUpdate{ - Properties: &armcompute.GalleryImageProperties{ - HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - Identifier: &armcompute.GalleryImageIdentifier{ - Offer: to.Ptr("myOfferName"), - Publisher: to.Ptr("myPublisherName"), - SKU: to.Ptr("mySkuName"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImage = armcompute.GalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageProperties{ - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Identifier: &armcompute.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Get.json -func ExampleGalleryImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImagesClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImage = armcompute.GalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageProperties{ - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Identifier: &armcompute.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_Delete.json -func ExampleGalleryImagesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImage_ListByGallery.json -func ExampleGalleryImagesClient_NewListByGalleryPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryImagesClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryImageList = armcompute.GalleryImageList{ - // Value: []*armcompute.GalleryImage{ - // { - // Name: to.Ptr("myGalleryImageName"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageProperties{ - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Identifier: &armcompute.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go deleted file mode 100644 index 45d8adabc3f5..000000000000 --- a/sdk/resourcemanager/compute/armcompute/galleryimageversions_client_example_test.go +++ /dev/null @@ -1,1852 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVmAsSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingCommunityGalleryImageAsSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - CommunityGalleryImageID: to.Ptr("/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // CommunityGalleryImageID: to.Ptr("/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingManagedImageAsSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingMixOfDisksAndSnapshotsAsASource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - DataDiskImages: []*armcompute.GalleryDataDiskImage{ - { - HostCaching: to.Ptr(armcompute.HostCachingNone), - Source: &armcompute.GalleryDiskImageSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"), - }, - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.GalleryOSDiskImage{ - HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - Source: &armcompute.GalleryDiskImageSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"), - // }, - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingShallowReplicationMode() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - ReplicationMode: to.Ptr(armcompute.ReplicationModeShallow), - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // ReplicationMode: to.Ptr(armcompute.ReplicationModeShallow), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingSharedImageAsSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVhdAsASource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - DataDiskImages: []*armcompute.GalleryDataDiskImage{ - { - HostCaching: to.Ptr(armcompute.HostCachingNone), - Source: &armcompute.GalleryDiskImageSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"), - URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"), - }, - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.GalleryOSDiskImage{ - HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - Source: &armcompute.GalleryDiskImageSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"), - URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"), - // URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"), - // }, - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"), - // URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json -func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionWithTargetExtendedLocationsSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{ - Location: to.Ptr("West US"), - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - Encryption: &armcompute.EncryptionImages{ - DataDiskImages: []*armcompute.DataDiskImageEncryption{ - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](0), - }, - { - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - Lun: to.Ptr[int32](1), - }}, - OSDiskImage: &armcompute.OSDiskImageEncryption{ - DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - }, - }, - ExcludeFromLatest: to.Ptr(false), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - AllowDeletionOfReplicatedLocations: to.Ptr(false), - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetExtendedLocations: []*armcompute.GalleryTargetExtendedLocation{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // }, - // }, - // ExtendedLocation: &armcompute.GalleryExtendedLocation{ - // Name: to.Ptr("microsoftlosangeles1"), - // Type: to.Ptr(armcompute.GalleryExtendedLocationTypeEdgeZone), - // }, - // ExtendedLocationReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountType("StandardSSD_LRS(default)")), - // }, - // { - // Name: to.Ptr("East US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // }, - // }, - // ExtendedLocation: &armcompute.GalleryExtendedLocation{ - // Name: to.Ptr("microsoftnewyork1"), - // Type: to.Ptr(armcompute.GalleryExtendedLocationTypeEdgeZone), - // }, - // ExtendedLocationReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountType("StandardSSD_LRS(default)")), - // }}, - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Update.json -func ExampleGalleryImageVersionsClient_BeginUpdate_updateASimpleGalleryImageVersionManagedImageAsSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersionUpdate{ - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - Source: &armcompute.GalleryArtifactVersionFullSource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.json -func ExampleGalleryImageVersionsClient_BeginUpdate_updateASimpleGalleryImageVersionWithoutSourceId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersionUpdate{ - Properties: &armcompute.GalleryImageVersionProperties{ - PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - TargetRegions: []*armcompute.TargetRegion{ - { - Name: to.Ptr("West US"), - RegionalReplicaCount: to.Ptr[int32](1), - }, - { - Name: to.Ptr("East US"), - RegionalReplicaCount: to.Ptr[int32](2), - StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - }}, - }, - StorageProfile: &armcompute.GalleryImageVersionStorageProfile{}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS), - // }}, - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.json -func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersionWithReplicationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: to.Ptr(armcompute.ReplicationStatusTypesReplicationStatus)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // ReplicationStatus: &armcompute.ReplicationStatus{ - // AggregatedState: to.Ptr(armcompute.AggregatedReplicationStateCompleted), - // Summary: []*armcompute.RegionalReplicationStatus{ - // { - // Progress: to.Ptr[int32](100), - // Region: to.Ptr("West US"), - // State: to.Ptr(armcompute.ReplicationStateCompleted), - // Details: to.Ptr(""), - // }, - // { - // Progress: to.Ptr[int32](100), - // Region: to.Ptr("East US"), - // State: to.Ptr(armcompute.ReplicationStateCompleted), - // Details: to.Ptr(""), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.json -func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersionWithSnapshotsAsASource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{diskSnapshotName}"), - // }, - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{snapshotName}"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.json -func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersionWithVhdAsASource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"), - // URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"), - // }, - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // Source: &armcompute.GalleryDiskImageSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"), - // URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Get.json -func ExampleGalleryImageVersionsClient_Get_getAGalleryImageVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImageVersionsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", &armcompute.GalleryImageVersionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImageVersion = armcompute.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_Delete.json -func ExampleGalleryImageVersionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImageVersionsClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/GalleryImageVersion_ListByGalleryImage.json -func ExampleGalleryImageVersionsClient_NewListByGalleryImagePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryImageVersionsClient().NewListByGalleryImagePager("myResourceGroup", "myGalleryName", "myGalleryImageName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryImageVersionList = armcompute.GalleryImageVersionList{ - // Value: []*armcompute.GalleryImageVersion{ - // { - // Name: to.Ptr("1.0.0"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.GalleryImageVersionProperties{ - // ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded), - // PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{ - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t}()), - // ReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // TargetRegions: []*armcompute.TargetRegion{ - // { - // Name: to.Ptr("West US"), - // Encryption: &armcompute.EncryptionImages{ - // DataDiskImages: []*armcompute.DataDiskImageEncryption{ - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"), - // Lun: to.Ptr[int32](0), - // }, - // { - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.OSDiskImageEncryption{ - // DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"), - // }, - // }, - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](1), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }, - // { - // Name: to.Ptr("East US"), - // ExcludeFromLatest: to.Ptr(false), - // RegionalReplicaCount: to.Ptr[int32](2), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS), - // }}, - // }, - // SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{ - // AllowDeletionOfReplicatedLocations: to.Ptr(false), - // PolicyViolations: []*armcompute.PolicyViolation{ - // { - // Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe), - // Details: to.Ptr("This is the policy violation details."), - // }}, - // ReportedForPolicyViolation: to.Ptr(true), - // }, - // StorageProfile: &armcompute.GalleryImageVersionStorageProfile{ - // DataDiskImages: []*armcompute.GalleryDataDiskImage{ - // { - // HostCaching: to.Ptr(armcompute.HostCachingNone), - // SizeInGB: to.Ptr[int32](10), - // Lun: to.Ptr[int32](1), - // }}, - // OSDiskImage: &armcompute.GalleryOSDiskImage{ - // HostCaching: to.Ptr(armcompute.HostCachingReadOnly), - // SizeInGB: to.Ptr[int32](10), - // }, - // Source: &armcompute.GalleryArtifactVersionFullSource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"), - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go b/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go deleted file mode 100644 index 8ec6bbe9ed29..000000000000 --- a/sdk/resourcemanager/compute/armcompute/gallerysharingprofile_client_example_test.go +++ /dev/null @@ -1,130 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_AddToSharingProfile.json -func ExampleGallerySharingProfileClient_BeginUpdate_addSharingIdToTheSharingProfileOfAGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGallerySharingProfileClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{ - Groups: []*armcompute.SharingProfileGroup{ - { - Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions), - IDs: []*string{ - to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"), - to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")}, - }, - { - Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants), - IDs: []*string{ - to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")}, - }}, - OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesAdd), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharingUpdate = armcompute.SharingUpdate{ - // Groups: []*armcompute.SharingProfileGroup{ - // { - // Type: to.Ptr(armcompute.SharingProfileGroupTypesSubscriptions), - // IDs: []*string{ - // to.Ptr("34a4ab42-0d72-47d9-bd1a-aed207386dac"), - // to.Ptr("380fd389-260b-41aa-bad9-0a83108c370b")}, - // }, - // { - // Type: to.Ptr(armcompute.SharingProfileGroupTypesAADTenants), - // IDs: []*string{ - // to.Ptr("c24c76aa-8897-4027-9b03-8f7928b54ff6")}, - // }}, - // OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesAdd), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_ResetSharingProfile.json -func ExampleGallerySharingProfileClient_BeginUpdate_resetSharingProfileOfAGallery() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGallerySharingProfileClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{ - OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesReset), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharingUpdate = armcompute.SharingUpdate{ - // OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesReset), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/galleryExamples/Gallery_EnableCommunityGallery.json -func ExampleGallerySharingProfileClient_BeginUpdate_shareAGalleryToCommunity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGallerySharingProfileClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", armcompute.SharingUpdate{ - OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesEnableCommunity), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharingUpdate = armcompute.SharingUpdate{ - // OperationType: to.Ptr(armcompute.SharingUpdateOperationTypesEnableCommunity), - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/go.mod b/sdk/resourcemanager/compute/armcompute/go.mod index 911c7d63ec64..f871228fb788 100644 --- a/sdk/resourcemanager/compute/armcompute/go.mod +++ b/sdk/resourcemanager/compute/armcompute/go.mod @@ -1,16 +1,16 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.0.0 github.com/stretchr/testify v1.7.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect diff --git a/sdk/resourcemanager/compute/armcompute/images_client.go b/sdk/resourcemanager/compute/armcompute/images_client.go index e7b8c19b2919..f9235e2abc60 100644 --- a/sdk/resourcemanager/compute/armcompute/images_client.go +++ b/sdk/resourcemanager/compute/armcompute/images_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *ImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, imageName, parameters, options) if err != nil { @@ -105,7 +105,7 @@ func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -114,7 +114,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -133,7 +133,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *ImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, imageName, options) if err != nil { @@ -169,7 +169,7 @@ func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -178,7 +178,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -220,7 +220,7 @@ func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupN if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,7 +238,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 2022-11-01 +// Generated from API version 2023-03-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]{ @@ -280,7 +280,7 @@ func (client *ImagesClient) listCreateRequest(ctx context.Context, options *Imag return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -297,7 +297,7 @@ func (client *ImagesClient) listHandleResponse(resp *http.Response) (ImagesClien // NewListByResourceGroupPager - Gets the list of images under a resource group. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - options - ImagesClientListByResourceGroupOptions contains the optional parameters for the ImagesClient.NewListByResourceGroupPager // method. @@ -345,7 +345,7 @@ func (client *ImagesClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -363,7 +363,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - imageName - The name of the image. // - parameters - Parameters supplied to the Update Image operation. @@ -383,7 +383,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *ImagesClient) update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, imageName, parameters, options) if err != nil { @@ -419,7 +419,7 @@ func (client *ImagesClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/images_client_example_test.go b/sdk/resourcemanager/compute/armcompute/images_client_example_test.go deleted file mode 100644 index 0eea572161a7..000000000000 --- a/sdk/resourcemanager/compute/armcompute/images_client_example_test.go +++ /dev/null @@ -1,946 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_CreateFromABlob.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromABlob() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - Snapshot: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_CreateFromAManagedDisk.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromAManagedDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - ManagedDisk: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - ManagedDisk: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - // }, - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_CreateFromASnapshot.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromASnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - OSDisk: &armcompute.ImageOSDisk{ - Snapshot: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_CreateFromAVM.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageFromAnExistingVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - SourceVirtualMachine: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // SourceVirtualMachine: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // }, - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // }, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myVM_OsDisk_1_6dc293b7d811433196903acf92665022"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_Create_DataDiskFromABlobIncluded.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageThatIncludesADataDiskFromABlob() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - DataDisks: []*armcompute.ImageDataDisk{ - { - BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - Lun: to.Ptr[int32](1), - }}, - OSDisk: &armcompute.ImageOSDisk{ - BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - DataDisks: []*armcompute.ImageDataDisk{ - { - ManagedDisk: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - }, - Lun: to.Ptr[int32](1), - }}, - OSDisk: &armcompute.ImageOSDisk{ - ManagedDisk: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(false), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.json -func ExampleImagesClient_BeginCreateOrUpdate_createAVirtualMachineImageThatIncludesADataDiskFromASnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myImage", armcompute.Image{ - Location: to.Ptr("West US"), - Properties: &armcompute.ImageProperties{ - StorageProfile: &armcompute.ImageStorageProfile{ - DataDisks: []*armcompute.ImageDataDisk{ - { - Snapshot: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - }, - Lun: to.Ptr[int32](1), - }}, - OSDisk: &armcompute.ImageOSDisk{ - Snapshot: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - }, - ZoneResilient: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/disk/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_Update.json -func ExampleImagesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginUpdate(ctx, "myResourceGroup", "myImage", armcompute.ImageUpdate{ - Tags: map[string]*string{ - "department": to.Ptr("HR"), - }, - Properties: &armcompute.ImageProperties{ - HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypesV1), - SourceVirtualMachine: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("HR"), - // }, - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // DiskSizeGB: to.Ptr[int32](20), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Images_Delete_MaximumSet_Gen.json -func ExampleImagesClient_BeginDelete_imagesDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Images_Delete_MinimumSet_Gen.json -func ExampleImagesClient_BeginDelete_imagesDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_Get.json -func ExampleImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImagesClient().Get(ctx, "myResourceGroup", "myImage", &armcompute.ImagesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armcompute.Image{ - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // DiskSizeGB: to.Ptr[int32](20), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // ZoneResilient: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_ListByResourceGroup.json -func ExampleImagesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageListResult = armcompute.ImageListResult{ - // Value: []*armcompute.Image{ - // { - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/imageExamples/Image_ListBySubscription.json -func ExampleImagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageListResult = armcompute.ImageListResult{ - // Value: []*armcompute.Image{ - // { - // Name: to.Ptr("myImage"), - // Type: to.Ptr("Microsoft.Compute/images"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.ImageProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.ImageStorageProfile{ - // DataDisks: []*armcompute.ImageDataDisk{ - // { - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // Lun: to.Ptr[int32](1), - // }}, - // OSDisk: &armcompute.ImageOSDisk{ - // BlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // ManagedDisk: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"), - // }, - // Snapshot: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/loganalytics_client.go b/sdk/resourcemanager/compute/armcompute/loganalytics_client.go index dc0dee2e82a6..b19f3a632fb8 100644 --- a/sdk/resourcemanager/compute/armcompute/loganalytics_client.go +++ b/sdk/resourcemanager/compute/armcompute/loganalytics_client.go @@ -49,7 +49,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *LogAnalyticsClient) exportRequestRateByInterval(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsClientBeginExportRequestRateByIntervalOptions) (*http.Response, error) { req, err := client.exportRequestRateByIntervalCreateRequest(ctx, location, parameters, options) if err != nil { @@ -104,7 +104,7 @@ func (client *LogAnalyticsClient) exportRequestRateByIntervalCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -114,7 +114,7 @@ func (client *LogAnalyticsClient) exportRequestRateByIntervalCreateRequest(ctx c // window. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 @@ -136,7 +136,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *LogAnalyticsClient) exportThrottledRequests(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsClientBeginExportThrottledRequestsOptions) (*http.Response, error) { req, err := client.exportThrottledRequestsCreateRequest(ctx, location, parameters, options) if err != nil { @@ -168,7 +168,7 @@ func (client *LogAnalyticsClient) exportThrottledRequestsCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go b/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go deleted file mode 100644 index 2d333ffd87ce..000000000000 --- a/sdk/resourcemanager/compute/armcompute/loganalytics_client_example_test.go +++ /dev/null @@ -1,93 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/logAnalyticExamples/LogAnalytics_RequestRateByInterval.json -func ExampleLogAnalyticsClient_BeginExportRequestRateByInterval() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogAnalyticsClient().BeginExportRequestRateByInterval(ctx, "westus", armcompute.RequestRateByIntervalInput{ - BlobContainerSasURI: to.Ptr("https://somesasuri"), - FromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-21T01:54:06.862601Z"); return t }()), - GroupByResourceName: to.Ptr(true), - ToTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-23T01:54:06.862601Z"); return t }()), - IntervalLength: to.Ptr(armcompute.IntervalInMinsFiveMins), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogAnalyticsOperationResult = armcompute.LogAnalyticsOperationResult{ - // Properties: &armcompute.LogAnalyticsOutput{ - // Output: to.Ptr("https://crptestar4227.blob.core.windows.net:443/sascontainer/RequestRateByInterval_20180121-0154_20180123-0154.csv"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/logAnalyticExamples/LogAnalytics_ThrottledRequests.json -func ExampleLogAnalyticsClient_BeginExportThrottledRequests() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogAnalyticsClient().BeginExportThrottledRequests(ctx, "westus", armcompute.ThrottledRequestsInput{ - BlobContainerSasURI: to.Ptr("https://somesasuri"), - FromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-21T01:54:06.862601Z"); return t }()), - GroupByClientApplicationID: to.Ptr(false), - GroupByOperationName: to.Ptr(true), - GroupByResourceName: to.Ptr(false), - GroupByUserAgent: to.Ptr(false), - ToTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-23T01:54:06.862601Z"); return t }()), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogAnalyticsOperationResult = armcompute.LogAnalyticsOperationResult{ - // Properties: &armcompute.LogAnalyticsOutput{ - // Output: to.Ptr("https://crptestar4227.blob.core.windows.net:443/sascontainer/ThrottledRequests_20180121-0154_20180123-0154.csv"), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/models.go b/sdk/resourcemanager/compute/armcompute/models.go index 061236a13db9..803326a3d8ca 100644 --- a/sdk/resourcemanager/compute/armcompute/models.go +++ b/sdk/resourcemanager/compute/armcompute/models.go @@ -108,8 +108,8 @@ type AutomaticOSUpgradePolicy struct { DisableAutomaticRollback *bool // Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer - // version of the OS image becomes available. Default value is false. - // If this is set to true for Windows based scale sets, enableAutomaticUpdates + // version of the OS image becomes available. Default value is false. If this is set + // to true for Windows based scale sets, enableAutomaticUpdates // [https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet] // is automatically set to false and cannot be set to true. EnableAutomaticOSUpgrade *bool @@ -145,9 +145,10 @@ type AutomaticRepairsPolicy struct { // AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual // machines specified in the same availability set are allocated to different nodes to maximize // availability. For more information about availability sets, see Availability sets overview [https://docs.microsoft.com/azure/virtual-machines/availability-set-overview]. -// For more information on Azure planned maintenance, see Maintenance and updates for Virtual Machines in Azure [https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates] -// Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability -// set. +// For more information on Azure +// planned maintenance, see Maintenance and updates for Virtual Machines in Azure [https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates]. +// Currently, a VM can only be added to an +// availability set at creation time. An existing VM cannot be added to an availability set. type AvailabilitySet struct { // REQUIRED; Resource location Location *string @@ -190,8 +191,8 @@ type AvailabilitySetProperties struct { // Update Domain count. PlatformUpdateDomainCount *int32 - // Specifies information about the proximity placement group that the availability set should be assigned to. - // Minimum api-version: 2018-04-01. + // Specifies information about the proximity placement group that the availability set should be assigned to. Minimum api-version: + // 2018-04-01. ProximityPlacementGroup *SubResource // A list of references to all virtual machines in the availability set. @@ -284,8 +285,7 @@ type AvailablePatchSummary struct { Status *PatchOperationStatus } -// BillingProfile - Specifies the billing related details of a Azure Spot VM or VMSS. -// Minimum api-version: 2019-03-01. +// BillingProfile - Specifies the billing related details of a Azure Spot VM or VMSS. Minimum api-version: 2019-03-01. type BillingProfile struct { // Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in US Dollars. // This price will be compared with the current Azure Spot price for the VM size. Also, the prices are compared at the time @@ -303,30 +303,29 @@ type BillingProfile struct { } // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose -// VM status. -// You can easily view the output of your console log. -// Azure also enables you to see a screenshot of the VM from the hypervisor. +// VM status. You can easily view the output of your console log. Azure also enables you to see +// a screenshot of the VM from the hypervisor. type BootDiagnostics struct { // Whether boot diagnostics should be enabled on the Virtual Machine. Enabled *bool - // Uri of the storage account to use for placing the console output and screenshot. - // If storageUri is not specified while enabling boot diagnostics, managed storage will be used. + // Uri of the storage account to use for placing the console output and screenshot. If storageUri is not specified while enabling + // boot diagnostics, managed storage will be used. StorageURI *string } // BootDiagnosticsInstanceView - The instance view of a virtual machine boot diagnostics. type BootDiagnosticsInstanceView struct { - // READ-ONLY; The console screenshot blob URI. - // NOTE: This will not be set if boot diagnostics is currently enabled with managed storage. + // READ-ONLY; The console screenshot blob URI. Note: This will not be set if boot diagnostics is currently enabled with managed + // storage. ConsoleScreenshotBlobURI *string - // READ-ONLY; The serial console log blob Uri. - // NOTE: This will not be set if boot diagnostics is currently enabled with managed storage. + // READ-ONLY; The serial console log blob Uri. Note: This will not be set if boot diagnostics is currently enabled with managed + // storage. SerialConsoleLogBlobURI *string - // READ-ONLY; The boot diagnostics status information for the VM. - // NOTE: It will be set only if there are errors encountered in enabling boot diagnostics. + // READ-ONLY; The boot diagnostics status information for the VM. Note: It will be set only if there are errors encountered + // in enabling boot diagnostics. Status *InstanceViewStatus } @@ -364,9 +363,8 @@ type CapacityReservation struct { } // CapacityReservationGroup - Specifies information about the capacity reservation group that the capacity reservations should -// be assigned to. -// Currently, a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity -// reservation cannot be added or moved to another capacity reservation group. +// be assigned to. Currently, a capacity reservation can only be added to a capacity reservation group at +// creation time. An existing capacity reservation cannot be added or moved to another capacity reservation group. type CapacityReservationGroup struct { // REQUIRED; Resource location Location *string @@ -521,10 +519,9 @@ type CapacityReservationProperties struct { // READ-ONLY; The Capacity reservation instance view. InstanceView *CapacityReservationInstanceView - // READ-ONLY; Specifies the value of fault domain count that Capacity Reservation supports for requested VM size. - // NOTE: The fault domain count specified for a resource (like virtual machines scale set) must be less than or equal to this - // value if it deploys using capacity reservation. - // Minimum api-version: 2022-08-01. + // READ-ONLY; Specifies the value of fault domain count that Capacity Reservation supports for requested VM size. Note: The + // fault domain count specified for a resource (like virtual machines scale set) must be less + // than or equal to this value if it deploys using capacity reservation. Minimum api-version: 2022-08-01. PlatformFaultDomainCount *int32 // READ-ONLY; The provisioning state, which only appears in the response. @@ -537,8 +534,7 @@ type CapacityReservationProperties struct { // the lifetime of the resource. ReservationID *string - // READ-ONLY; Specifies the time at which the Capacity Reservation resource was created. - // Minimum api-version: 2021-11-01. + // READ-ONLY; Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: 2021-11-01. TimeCreated *time.Time // READ-ONLY; A list of all virtual machine resource ids that are associated with the capacity reservation. @@ -563,8 +559,7 @@ type CapacityReservationUpdate struct { // CapacityReservationUtilization - Represents the capacity reservation utilization in terms of resources allocated. type CapacityReservationUtilization struct { // READ-ONLY; The value provides the current capacity of the VM size which was reserved successfully and for which the customer - // is getting billed. - // Minimum api-version: 2022-08-01. + // is getting billed. Minimum api-version: 2022-08-01. CurrentCapacity *int32 // READ-ONLY; A list of all virtual machines resource ids allocated against the capacity reservation. @@ -1324,46 +1319,39 @@ type CreationData struct { // DataDisk - Describes a data disk. type DataDisk struct { - // REQUIRED; Specifies how the virtual machine should be created. - // Possible values are: - // Attach \u2013 This value is used when you are using a specialized disk to create the virtual machine. - // FromImage \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform - // image, you also use the imageReference element described above. If you are - // using a marketplace image, you also use the plan element previously described. + // REQUIRED; Specifies how the virtual machine should be created. Possible values are: Attach. This value is used when you + // are using a specialized disk to create the virtual machine. FromImage. This value is used + // when you are using an image to create the virtual machine. If you are using a platform image, you should also use the imageReference + // element described above. If you are using a marketplace image, you + // should also use the plan element previously described. CreateOption *DiskCreateOptionTypes // REQUIRED; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and // therefore must be unique for each data disk attached to a VM. Lun *int32 - // Specifies the caching requirements. - // Possible values are: - // None - // ReadOnly - // ReadWrite - // Default: None for Standard storage. ReadOnly for Premium storage + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for + // Standard storage. ReadOnly for Premium storage. Caching *CachingTypes - // Specifies whether data disk should be deleted or detached upon VM deletion. - // Possible values: - // Delete If this value is used, the data disk is deleted when VM is deleted. - // Detach If this value is used, the data disk is retained after VM is deleted. - // The default value is set to detach + // Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: Delete. If this value + // is used, the data disk is deleted when VM is deleted. Detach. If this value is + // used, the data disk is retained after VM is deleted. The default value is set to Detach. DeleteOption *DiskDeleteOptionTypes // Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment from the - // virtual machine. Supported values: ForceDetach. - // detachOption: ForceDetach is applicable only for managed data disks. If a previous detachment attempt of the data disk - // did not complete due to an unexpected failure from the virtual machine and the - // disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes - // might not have been flushed when using this detach behavior. - // This feature is still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update - // toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. + // virtual machine. Supported values: ForceDetach. detachOption: ForceDetach is + // applicable only for managed data disks. If a previous detachment attempt of the data disk did not complete due to an unexpected + // failure from the virtual machine and the disk is still not released then + // use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed + // when using this detach behavior. This feature is still in preview mode and is + // not supported for VirtualMachineScaleSet. To force-detach a data disk update toBeDetached to 'true' along with setting + // detachOption: 'ForceDetach'. DetachOption *DiskDetachOptionTypes // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a - // virtual machine image. - // diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023 + // virtual machine image. The property 'diskSizeGB' is the number of bytes x 1024^3 + // for the disk and the value cannot be larger than 1023. DiskSizeGB *int32 // The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. @@ -1457,8 +1445,8 @@ type DedicatedHostAvailableCapacity struct { } // DedicatedHostGroup - Specifies information about the dedicated host group that the dedicated hosts should be assigned to. -// Currently, a dedicated host can only be added to a dedicated host group at creation time. An existing dedicated host cannot -// be added to another dedicated host group. +// Currently, a dedicated host can only be added to a dedicated host group at creation time. An +// existing dedicated host cannot be added to another dedicated host group. type DedicatedHostGroup struct { // REQUIRED; Resource location Location *string @@ -1504,14 +1492,13 @@ type DedicatedHostGroupProperties struct { // REQUIRED; Number of fault domains that the host group can span. PlatformFaultDomainCount *int32 - // Enables or disables a capability on the dedicated host group. - // Minimum api-version: 2022-03-01. + // Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01. AdditionalCapabilities *DedicatedHostGroupPropertiesAdditionalCapabilities // Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. // Automatic placement means resources are allocated on dedicated hosts, that are - // chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. - // Minimum api-version: 2020-06-01. + // chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. Minimum api-version: + // 2020-06-01. SupportAutomaticPlacement *bool // READ-ONLY; A list of references to all dedicated hosts in the dedicated host group. @@ -1522,16 +1509,16 @@ type DedicatedHostGroupProperties struct { InstanceView *DedicatedHostGroupInstanceView } -// DedicatedHostGroupPropertiesAdditionalCapabilities - Enables or disables a capability on the dedicated host group. -// Minimum api-version: 2022-03-01. +// DedicatedHostGroupPropertiesAdditionalCapabilities - Enables or disables a capability on the dedicated host group. Minimum +// api-version: 2022-03-01. type DedicatedHostGroupPropertiesAdditionalCapabilities struct { // The flag that enables or disables a capability to have UltraSSD Enabled Virtual Machines on Dedicated Hosts of the Dedicated // Host Group. For the Virtual Machines to be UltraSSD Enabled, // UltraSSDEnabled flag for the resource needs to be set true as well. The value is defaulted to 'false' when not provided. // Please refer to - // https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd for more details on Ultra SSD feature. - // NOTE: The ultraSSDEnabled setting can only be enabled for Host Groups that are created as zonal. - // Minimum api-version: 2022-03-01. + // https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd for more details on Ultra SSD feature. Note: + // The ultraSSDEnabled setting can only be enabled for Host Groups that are + // created as zonal. Minimum api-version: 2022-03-01. UltraSSDEnabled *bool } @@ -1629,19 +1616,15 @@ type DedicatedHostProperties struct { // when not provided. AutoReplaceOnFailure *bool - // Specifies the software license type that will be applied to the VMs deployed on the dedicated host. - // Possible values are: - // None - // WindowsServerHybrid - // WindowsServerPerpetual - // Default: None + // Specifies the software license type that will be applied to the VMs deployed on the dedicated host. Possible values are: + // None, WindowsServerHybrid, WindowsServerPerpetual. The default value is: None. LicenseType *DedicatedHostLicenseTypes // Fault domain of the dedicated host within a dedicated host group. PlatformFaultDomain *int32 - // READ-ONLY; A unique id generated and assigned to the dedicated host by the platform. - // Does not change throughout the lifetime of the host. + // READ-ONLY; A unique id generated and assigned to the dedicated host by the platform. Does not change throughout the lifetime + // of the host. HostID *string // READ-ONLY; The dedicated host instance view. @@ -1653,20 +1636,30 @@ type DedicatedHostProperties struct { // READ-ONLY; The date when the host was first provisioned. ProvisioningTime *time.Time - // READ-ONLY; Specifies the time at which the Dedicated Host resource was created. - // Minimum api-version: 2021-11-01. + // READ-ONLY; Specifies the time at which the Dedicated Host resource was created. Minimum api-version: 2021-11-01. TimeCreated *time.Time // READ-ONLY; A list of references to all virtual machines in the Dedicated Host. VirtualMachines []*SubResourceReadOnly } +// DedicatedHostSizeListResult - The List Dedicated Host sizes operation response. +type DedicatedHostSizeListResult struct { + // The list of dedicated host sizes. + Value []*string +} + // DedicatedHostUpdate - Specifies information about the dedicated host. Only tags, autoReplaceOnFailure and licenseType may // be updated. type DedicatedHostUpdate struct { // Properties of the dedicated host. Properties *DedicatedHostProperties + // List all available dedicated host sizes for resizing [https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes]. + // Resizing can be only used to scale up DedicatedHost. Only name is + // required to be set. + SKU *SKU + // Resource tags Tags map[string]*string } @@ -1703,37 +1696,38 @@ type DedicatedHostsClientGetOptions struct { Expand *InstanceViewTypes } +// DedicatedHostsClientListAvailableSizesOptions contains the optional parameters for the DedicatedHostsClient.NewListAvailableSizesPager +// method. +type DedicatedHostsClientListAvailableSizesOptions struct { + // placeholder for future optional parameters +} + // DedicatedHostsClientListByHostGroupOptions contains the optional parameters for the DedicatedHostsClient.NewListByHostGroupPager // method. type DedicatedHostsClientListByHostGroupOptions struct { // placeholder for future optional parameters } -// DiagnosticsProfile - Specifies the boot diagnostic settings state. -// Minimum api-version: 2015-06-15. +// DiagnosticsProfile - Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. type DiagnosticsProfile struct { - // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. - // NOTE: If storageUri is being specified then ensure that the storage account is in the same region and subscription as the - // VM. - // You can easily view the output of your console log. - // Azure also enables you to see a screenshot of the VM from the hypervisor. + // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. NOTE: + // If storageUri is being specified then ensure that the storage account is in + // the same region and subscription as the VM. You can easily view the output of your console log. Azure also enables you + // to see a screenshot of the VM from the hypervisor. BootDiagnostics *BootDiagnostics } // DiffDiskSettings - Describes the parameters of ephemeral disk settings that can be specified for operating system disk. -// NOTE: The ephemeral disk settings can only be specified for managed disk. +// Note: The ephemeral disk settings can only be specified for managed disk. type DiffDiskSettings struct { // Specifies the ephemeral disk settings for operating system disk. Option *DiffDiskOptions - // Specifies the ephemeral disk placement for operating system disk. - // Possible values are: - // CacheDisk - // ResourceDisk - // Default: CacheDisk if one is configured for the VM size otherwise ResourceDisk is used. - // Refer to VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux - // VM at https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check - // which VM sizes exposes a cache disk. + // Specifies the ephemeral disk placement for operating system disk. Possible values are: CacheDisk, ResourceDisk. The defaulting + // behavior is: CacheDisk if one is configured for the VM size otherwise + // ResourceDisk is used. Refer to the VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes + // and Linux VM at + // https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Placement *DiffDiskPlacement } @@ -1937,9 +1931,8 @@ type DiskEncryptionSetList struct { } // DiskEncryptionSetParameters - Describes the parameter of customer managed disk encryption set resource id that can be specified -// for disk. -// NOTE: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview -// for more details. +// for disk. Note: The disk encryption set resource id can only be specified for managed disk. Please +// refer https://aka.ms/mdssewithcmkoverview for more details. type DiskEncryptionSetParameters struct { // Resource Id ID *string @@ -2198,6 +2191,19 @@ type DiskRestorePoint struct { Type *string } +// DiskRestorePointAttributes - Disk Restore Point details. +type DiskRestorePointAttributes struct { + // Encryption at rest settings for disk restore point. It is an optional property that can be specified in the input while + // creating a restore point. + Encryption *RestorePointEncryption + + // Resource Id of the source disk restore point. + SourceDiskRestorePoint *APIEntityReference + + // READ-ONLY; Resource Id + ID *string +} + // DiskRestorePointClientBeginGrantAccessOptions contains the optional parameters for the DiskRestorePointClient.BeginGrantAccess // method. type DiskRestorePointClientBeginGrantAccessOptions struct { @@ -3440,20 +3446,19 @@ type GrantAccessData struct { // HardwareProfile - Specifies the hardware settings for the virtual machine. type HardwareProfile struct { - // Specifies the size of the virtual machine. - // The enum data type is currently deprecated and will be removed by December 23rd 2023. - // Recommended way to get the list of available sizes is using these APIs: - // List all available virtual machine sizes in an availability set [https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes] - // List all available virtual machine sizes in a region [https://docs.microsoft.com/rest/api/compute/resourceskus/list] - // List all available virtual machine sizes for resizing [https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes]. - // For more information about virtual machine sizes, see Sizes for - // virtual machines [https://docs.microsoft.com/azure/virtual-machines/sizes]. - // The available VM sizes depend on region and availability set. + // Specifies the size of the virtual machine. The enum data type is currently deprecated and will be removed by December 23rd + // 2023. The recommended way to get the list of available sizes is using these + // APIs: List all available virtual machine sizes in an availability set [https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes], + // List all available virtual machine sizes in a + // region [https://docs.microsoft.com/rest/api/compute/resourceskus/list], List all available virtual machine sizes for resizing + // [https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes]. For more information about virtual machine + // sizes, see Sizes for virtual machines + // [https://docs.microsoft.com/azure/virtual-machines/sizes]. The available VM sizes depend on region and availability set. VMSize *VirtualMachineSizeTypes - // Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-07-01. - // This feature is still in preview mode and is not supported for VirtualMachineScaleSet. - // Please follow the instructions in VM Customization [https://aka.ms/vmcustomization] for more details. + // Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-07-01. This feature + // is still in preview mode and is not supported for VirtualMachineScaleSet. Please + // follow the instructions in VM Customization [https://aka.ms/vmcustomization] for more details. VMSizeProperties *VMSizeProperties } @@ -3492,20 +3497,15 @@ type ImageDataDisk struct { // The Virtual Hard Disk. BlobURI *string - // Specifies the caching requirements. - // Possible values are: - // None - // ReadOnly - // ReadWrite - // Default: None for Standard storage. ReadOnly for Premium storage + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. Caching *CachingTypes // Specifies the customer managed disk encryption set resource id for the managed image disk. DiskEncryptionSet *DiskEncryptionSetParameters // Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual - // machine image. - // This value cannot be larger than 1023 GB + // machine image. This value cannot be larger than 1023 GB. DiskSizeGB *int32 // The managedDisk. @@ -3536,20 +3536,15 @@ type ImageDisk struct { // The Virtual Hard Disk. BlobURI *string - // Specifies the caching requirements. - // Possible values are: - // None - // ReadOnly - // ReadWrite - // Default: None for Standard storage. ReadOnly for Premium storage + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. Caching *CachingTypes // Specifies the customer managed disk encryption set resource id for the managed image disk. DiskEncryptionSet *DiskEncryptionSetParameters // Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual - // machine image. - // This value cannot be larger than 1023 GB + // machine image. This value cannot be larger than 1023 GB. DiskSizeGB *int32 // The managedDisk. @@ -3594,29 +3589,21 @@ type ImageOSDisk struct { OSState *OperatingSystemStateTypes // REQUIRED; This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom - // image. - // Possible values are: - // Windows - // Linux + // image. Possible values are: Windows, Linux. OSType *OperatingSystemTypes // The Virtual Hard Disk. BlobURI *string - // Specifies the caching requirements. - // Possible values are: - // None - // ReadOnly - // ReadWrite - // Default: None for Standard storage. ReadOnly for Premium storage + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. Caching *CachingTypes // Specifies the customer managed disk encryption set resource id for the managed image disk. DiskEncryptionSet *DiskEncryptionSetParameters // Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual - // machine image. - // This value cannot be larger than 1023 GB + // machine image. This value cannot be larger than 1023 GB. DiskSizeGB *int32 // The managedDisk. @@ -3898,8 +3885,9 @@ type LatestGalleryImageVersion struct { Location *string } -// LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine. -// For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. +// LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine. For a list of supported Linux +// distributions, see Linux on Azure-Endorsed Distributions +// [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. type LinuxConfiguration struct { // Specifies whether password authentication should be disabled. DisablePasswordAuthentication *bool @@ -3910,9 +3898,9 @@ type LinuxConfiguration struct { // [Preview Feature] Specifies settings related to VM Guest Patching on Linux. PatchSettings *LinuxPatchSettings - // Indicates whether virtual machine agent should be provisioned on the virtual machine. - // When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM - // Agent is installed on the VM so that extensions can be added to the VM later. + // Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified + // in the request body, default behavior is to set it to true. This will ensure + // that VM Agent is installed on the VM so that extensions can be added to the VM later. ProvisionVMAgent *bool // Specifies the ssh key configuration for a Linux OS. @@ -3957,6 +3945,9 @@ type LinuxPatchSettings struct { // LinuxVMGuestPatchAutomaticByPlatformSettings - Specifies additional settings to be applied when patch mode AutomaticByPlatform // is selected in Linux patch settings. type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + // Enables customer to schedule patching without accidental upgrades + BypassPlatformSafetyChecksOnUserSchedule *bool + // Specifies the reboot setting for all AutomaticByPlatform patch installation operations. RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting } @@ -4142,43 +4133,37 @@ type NetworkProfile struct { NetworkInterfaces []*NetworkInterfaceReference } -// OSDisk - Specifies information about the operating system disk used by the virtual machine. -// For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. +// OSDisk - Specifies information about the operating system disk used by the virtual machine. For more information about +// disks, see About disks and VHDs for Azure virtual machines +// [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. type OSDisk struct { - // REQUIRED; Specifies how the virtual machine should be created. - // Possible values are: - // Attach \u2013 This value is used when you are using a specialized disk to create the virtual machine. - // FromImage \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform - // image, you also use the imageReference element described above. If you are - // using a marketplace image, you also use the plan element previously described. + // REQUIRED; Specifies how the virtual machine should be created. Possible values are: Attach. This value is used when you + // are using a specialized disk to create the virtual machine. FromImage. This value is used + // when you are using an image to create the virtual machine. If you are using a platform image, you should also use the imageReference + // element described above. If you are using a marketplace image, you + // should also use the plan element previously described. CreateOption *DiskCreateOptionTypes - // Specifies the caching requirements. - // Possible values are: - // None - // ReadOnly - // ReadWrite - // Default: None for Standard storage. ReadOnly for Premium storage. + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The defaulting behavior is: None for + // Standard storage. ReadOnly for Premium storage. Caching *CachingTypes - // Specifies whether OS Disk should be deleted or detached upon VM deletion. - // Possible values: - // Delete If this value is used, the OS disk is deleted when VM is deleted. - // Detach If this value is used, the os disk is retained after VM is deleted. - // The default value is set to detach. For an ephemeral OS Disk, the default value is set to Delete. User cannot change the - // delete option for ephemeral OS Disk. + // Specifies whether OS Disk should be deleted or detached upon VM deletion. Possible values are: Delete. If this value is + // used, the OS disk is deleted when VM is deleted. Detach. If this value is used, + // the os disk is retained after VM is deleted. The default value is set to Detach. For an ephemeral OS Disk, the default + // value is set to Delete. The user cannot change the delete option for an ephemeral + // OS Disk. DeleteOption *DiskDeleteOptionTypes // Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. DiffDiskSettings *DiffDiskSettings // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a - // virtual machine image. - // diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023 + // virtual machine image. The property 'diskSizeGB' is the number of bytes x 1024^3 + // for the disk and the value cannot be larger than 1023. DiskSizeGB *int32 - // Specifies the encryption settings for the OS Disk. - // Minimum api-version: 2015-06-15 + // Specifies the encryption settings for the OS Disk. Minimum api-version: 2015-06-15. EncryptionSettings *DiskEncryptionSettings // The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. @@ -4193,10 +4178,7 @@ type OSDisk struct { Name *string // This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or - // a specialized VHD. - // Possible values are: - // Windows - // Linux + // a specialized VHD. Possible values are: Windows, Linux. OSType *OperatingSystemTypes // The virtual hard disk. @@ -4311,28 +4293,27 @@ type OSProfile struct { // Max-length (Windows): 20 characters. AdminUsername *string - // Specifies whether extension operations should be allowed on the virtual machine. - // This may only be set to False when no extensions are present on the virtual machine. + // Specifies whether extension operations should be allowed on the virtual machine. This may only be set to False when no + // extensions are present on the virtual machine. AllowExtensionOperations *bool - // Specifies the host OS name of the virtual machine. - // This name cannot be updated after the VM is created. - // Max-length (Windows): 15 characters - // Max-length (Linux): 64 characters. - // For naming conventions and restrictions see Azure infrastructure services implementation guidelines [https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules]. + // Specifies the host OS name of the virtual machine. This name cannot be updated after the VM is created. Max-length (Windows): + // 15 characters. Max-length (Linux): 64 characters. For naming conventions + // and restrictions see Azure infrastructure services implementation guidelines [https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules]. ComputerName *string // Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved // as a file on the Virtual Machine. The maximum length of the binary array is - // 65535 bytes. - // Note: Do not pass any secrets or passwords in customData property - // This property cannot be updated after the VM is created. - // customData is passed to the VM to be saved as a file, for more information see Custom Data on Azure VMs [https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/] - // For using cloud-init for your Linux VM, see Using cloud-init to customize a Linux VM during creation [https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init] + // 65535 bytes. Note: Do not pass any secrets or passwords in customData property. This property cannot be updated after the + // VM is created. The property 'customData' is passed to the VM to be saved as a + // file, for more information see Custom Data on Azure VMs [https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/]. + // For using cloud-init for your Linux VM, see Using cloud-init to + // customize a Linux VM during creation [https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init]. CustomData *string - // Specifies the Linux operating system settings on the virtual machine. - // For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. + // Specifies the Linux operating system settings on the virtual machine. For a list of supported Linux distributions, see + // Linux on Azure-Endorsed Distributions + // [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. LinuxConfiguration *LinuxConfiguration // Optional property which must either be set to True or omitted. @@ -4370,11 +4351,11 @@ type OSProfileProvisioningData struct { // Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved // as a file on the Virtual Machine. The maximum length of the binary array is - // 65535 bytes. - // Note: Do not pass any secrets or passwords in customData property - // This property cannot be updated after the VM is created. - // customData is passed to the VM to be saved as a file, for more information see Custom Data on Azure VMs [https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/] - // For using cloud-init for your Linux VM, see Using cloud-init to customize a Linux VM during creation [https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init] + // 65535 bytes. Note: Do not pass any secrets or passwords in customData property. This property cannot be updated after the + // VM is created. The property customData is passed to the VM to be saved as a + // file, for more information see Custom Data on Azure VMs [https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/]. + // If using cloud-init for your Linux VM, see Using cloud-init to + // customize a Linux VM during creation [https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init]. CustomData *string } @@ -4612,9 +4593,8 @@ type PolicyViolation struct { } // PriorityMixPolicy - Specifies the target splits for Spot and Regular priority VMs within a scale set with flexible orchestration -// mode. -// With this property the customer is able to specify the base number of regular priority VMs created as the VMSS flex instance -// scales out and the split between Spot and Regular priority VMs after this +// mode. With this property the customer is able to specify the base number of regular +// priority VMs created as the VMSS flex instance scales out and the split between Spot and Regular priority VMs after this // base target has been reached. type PriorityMixPolicy struct { // The base number of regular priority VMs that will be created in this scale set as it scales out. @@ -4761,10 +4741,8 @@ type ProximityPlacementGroupProperties struct { // Specifies the user intent of the proximity placement group. Intent *ProximityPlacementGroupPropertiesIntent - // Specifies the type of the proximity placement group. - // Possible values are: - // Standard : Co-locate resources within an Azure region or Availability Zone. - // Ultra : For future use. + // Specifies the type of the proximity placement group. Possible values are: Standard : Co-locate resources within an Azure + // region or Availability Zone. Ultra : For future use. ProximityPlacementGroupType *ProximityPlacementGroupType // READ-ONLY; A list of references to all availability sets in the proximity placement group. @@ -5296,6 +5274,18 @@ type RestorePointCollectionsClientUpdateOptions struct { // placeholder for future optional parameters } +// RestorePointEncryption - Encryption at rest settings for disk restore point. It is an optional property that can be specified +// in the input while creating a restore point. +type RestorePointEncryption struct { + // Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. Note: The disk + // encryption set resource id can only be specified for managed disk. Please + // refer https://aka.ms/mdssewithcmkoverview for more details. + DiskEncryptionSet *DiskEncryptionSetParameters + + // The type of key used to encrypt the data of the disk restore point. + Type *RestorePointEncryptionType +} + // RestorePointInstanceView - The instance view of a restore point. type RestorePointInstanceView struct { // The disk restore points information. @@ -5316,6 +5306,9 @@ type RestorePointProperties struct { // will be included. ExcludeDisks []*APIEntityReference + // Gets the details of the VM captured at the time of the restore point creation. + SourceMetadata *RestorePointSourceMetadata + // Resource Id of the source restore point from which a copy needs to be created. SourceRestorePoint *APIEntityReference @@ -5327,86 +5320,92 @@ type RestorePointProperties struct { // READ-ONLY; Gets the provisioning state of the restore point. ProvisioningState *string - - // READ-ONLY; Gets the details of the VM captured at the time of the restore point creation. - SourceMetadata *RestorePointSourceMetadata } // RestorePointSourceMetadata - Describes the properties of the Virtual Machine for which the restore point was created. The // properties provided are a subset and the snapshot of the overall Virtual Machine properties captured at the // time of the restore point creation. type RestorePointSourceMetadata struct { - // Gets the diagnostics profile. + // Gets the storage profile. + StorageProfile *RestorePointSourceVMStorageProfile + + // READ-ONLY; Gets the diagnostics profile. DiagnosticsProfile *DiagnosticsProfile - // Gets the hardware profile. + // READ-ONLY; Gets the hardware profile. HardwareProfile *HardwareProfile - // Gets the license type, which is for bring your own license scenario. + // READ-ONLY; HyperVGeneration of the source VM for which restore point is captured. + HyperVGeneration *HyperVGenerationTypes + + // READ-ONLY; Gets the license type, which is for bring your own license scenario. LicenseType *string - // Location of the VM from which the restore point was created. + // READ-ONLY; Location of the VM from which the restore point was created. Location *string - // Gets the OS profile. + // READ-ONLY; Gets the OS profile. OSProfile *OSProfile - // Gets the security profile. + // READ-ONLY; Gets the security profile. SecurityProfile *SecurityProfile - // Gets the storage profile. - StorageProfile *RestorePointSourceVMStorageProfile - - // UserData associated with the source VM for which restore point is captured, which is a base-64 encoded value. + // READ-ONLY; UserData associated with the source VM for which restore point is captured, which is a base-64 encoded value. UserData *string - // Gets the virtual machine unique id. + // READ-ONLY; Gets the virtual machine unique id. VMID *string } // RestorePointSourceVMDataDisk - Describes a data disk. type RestorePointSourceVMDataDisk struct { - // Gets the caching type. - Caching *CachingTypes + // Contains Disk Restore Point properties. + DiskRestorePoint *DiskRestorePointAttributes - // Gets the disk restore point Id. - DiskRestorePoint *APIEntityReference + // Contains the managed disk details. + ManagedDisk *ManagedDiskParameters + + // READ-ONLY; Gets the caching type. + Caching *CachingTypes - // Gets the initial disk size in GB for blank data disks, and the new desired size for existing OS and Data disks. + // READ-ONLY; Gets the initial disk size in GB for blank data disks, and the new desired size for existing OS and Data disks. DiskSizeGB *int32 - // Gets the logical unit number. + // READ-ONLY; Gets the logical unit number. Lun *int32 - // Gets the managed disk details - ManagedDisk *ManagedDiskParameters - - // Gets the disk name. + // READ-ONLY; Gets the disk name. Name *string + + // READ-ONLY; Shows true if the disk is write-accelerator enabled. + WriteAcceleratorEnabled *bool } // RestorePointSourceVMOSDisk - Describes an Operating System disk. type RestorePointSourceVMOSDisk struct { - // Gets the caching type. - Caching *CachingTypes + // Contains Disk Restore Point properties. + DiskRestorePoint *DiskRestorePointAttributes - // Gets the disk restore point Id. - DiskRestorePoint *APIEntityReference + // Gets the managed disk details + ManagedDisk *ManagedDiskParameters + + // READ-ONLY; Gets the caching type. + Caching *CachingTypes - // Gets the disk size in GB. + // READ-ONLY; Gets the disk size in GB. DiskSizeGB *int32 - // Gets the disk encryption settings. + // READ-ONLY; Gets the disk encryption settings. EncryptionSettings *DiskEncryptionSettings - // Gets the managed disk details - ManagedDisk *ManagedDiskParameters - - // Gets the disk name. + // READ-ONLY; Gets the disk name. Name *string - // Gets the Operating System type. + // READ-ONLY; Gets the Operating System type. OSType *OperatingSystemType + + // READ-ONLY; Shows true if the disk is write-accelerator enabled. + WriteAcceleratorEnabled *bool } // RestorePointSourceVMStorageProfile - Describes the storage profile. @@ -5708,6 +5707,21 @@ type RunCommandListResult struct { NextLink *string } +// RunCommandManagedIdentity - Contains clientId or objectId (use only one, not both) of a user-assigned managed identity +// that has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object in case of +// system-assigned identity. Make sure the Azure storage blob exists in case of scriptUri, and managed identity has been given +// access to blob's container with 'Storage Blob Data Reader' role assignment +// with scriptUri blob and 'Storage Blob Data Contributor' for Append blobs(outputBlobUri, errorBlobUri). In case of user +// assigned identity, make sure you add it under VM's identity. For more info on +// managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. +type RunCommandManagedIdentity struct { + // Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided. + ClientID *string + + // Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided. + ObjectID *string +} + // RunCommandParameterDefinition - Describes the properties of a run command parameter. type RunCommandParameterDefinition struct { // REQUIRED; The run command parameter name. @@ -5755,8 +5769,8 @@ type SSHConfiguration struct { // is placed. type SSHPublicKey struct { // SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa - // format. - // For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + // format. For creating ssh keys, see [Create SSH keys on Linux and Mac for + // Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). KeyData *string // Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key @@ -5894,20 +5908,31 @@ type ScheduledEventsProfile struct { TerminateNotificationProfile *TerminateNotificationProfile } +// SecurityPostureReference - Specifies the security posture to be used for all virtual machines in the scale set. Minimum +// api-version: 2023-03-01 +type SecurityPostureReference struct { + // List of virtual machine extensions to exclude when applying the Security Posture. + ExcludeExtensions []*VirtualMachineExtension + + // The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest + ID *string +} + // SecurityProfile - Specifies the Security profile settings for the virtual machine or virtual machine scale set. type SecurityProfile struct { // This property can be used by user in the request to enable or disable the Host Encryption for the virtual machine or virtual // machine scale set. This will enable the encryption for all the disks - // including Resource/Temp disk at host itself. - // Default: The Encryption at host will be disabled unless this property is set to true for the resource. + // including Resource/Temp disk at host itself. The default behavior is: The Encryption at host will be disabled unless this + // property is set to true for the resource. EncryptionAtHost *bool - // Specifies the SecurityType of the virtual machine. It has to be set to any specified value to enable UefiSettings. - // Default: UefiSettings will not be enabled unless this property is set. + // Specifies the SecurityType of the virtual machine. It has to be set to any specified value to enable UefiSettings. The + // default behavior is: UefiSettings will not be enabled unless this property is + // set. SecurityType *SecurityTypes - // Specifies the security settings like secure boot and vTPM used while creating the virtual machine. - // Minimum api-version: 2020-12-01 + // Specifies the security settings like secure boot and vTPM used while creating the virtual machine. Minimum api-version: + // 2020-12-01. UefiSettings *UefiSettings } @@ -6425,8 +6450,8 @@ type SourceVault struct { ID *string } -// SpotRestorePolicy - Specifies the Spot-Try-Restore properties for the virtual machine scale set. -// With this property customer can enable or disable automatic restore of the evicted Spot VMSS VM instances opportunistically +// SpotRestorePolicy - Specifies the Spot-Try-Restore properties for the virtual machine scale set. With this property customer +// can enable or disable automatic restore of the evicted Spot VMSS VM instances opportunistically // based on capacity availability and pricing constraint. type SpotRestorePolicy struct { // Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to be restored opportunistically based @@ -6448,17 +6473,17 @@ type StatusCodeCount struct { // StorageProfile - Specifies the storage settings for the virtual machine disks. type StorageProfile struct { - // Specifies the parameters that are used to add a data disk to a virtual machine. - // For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + // Specifies the parameters that are used to add a data disk to a virtual machine. For more information about disks, see About + // disks and VHDs for Azure virtual machines + // [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. DataDisks []*DataDisk - // Specifies the disk controller type configured for the VM. - // NOTE: This property will be set to the default disk controller type if not specified provided virtual machine is being - // created as a hyperVGeneration: V2 based on the capabilities of the operating - // system disk and VM size from the the specified minimum api version. - // You need to deallocate the VM before updating its disk controller type unless you are updating the VM size in the VM configuration - // which implicitly deallocates and reallocates the VM. - // Minimum api-version: 2022-08-01 + // Specifies the disk controller type configured for the VM. Note: This property will be set to the default disk controller + // type if not specified provided virtual machine is being created with + // 'hyperVGeneration' set to V2 based on the capabilities of the operating system disk and VM size from the the specified + // minimum api version. You need to deallocate the VM before updating its disk + // controller type unless you are updating the VM size in the VM configuration which implicitly deallocates and reallocates + // the VM. Minimum api-version: 2022-08-01. DiskControllerType *DiskControllerTypes // Specifies information about the image to use. You can specify information about platform images, marketplace images, or @@ -6466,8 +6491,9 @@ type StorageProfile struct { // image, marketplace image, or virtual machine image, but is not used in other creation operations. ImageReference *ImageReference - // Specifies information about the operating system disk used by the virtual machine. - // For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + // Specifies information about the operating system disk used by the virtual machine. For more information about disks, see + // About disks and VHDs for Azure virtual machines + // [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. OSDisk *OSDisk } @@ -6567,15 +6593,13 @@ type ThrottledRequestsInput struct { GroupByUserAgent *bool } -// UefiSettings - Specifies the security settings like secure boot and vTPM used while creating the virtual machine. -// Minimum api-version: 2020-12-01 +// UefiSettings - Specifies the security settings like secure boot and vTPM used while creating the virtual machine. Minimum +// api-version: 2020-12-01. type UefiSettings struct { - // Specifies whether secure boot should be enabled on the virtual machine. - // Minimum api-version: 2020-12-01 + // Specifies whether secure boot should be enabled on the virtual machine. Minimum api-version: 2020-12-01. SecureBootEnabled *bool - // Specifies whether vTPM should be enabled on the virtual machine. - // Minimum api-version: 2020-12-01 + // Specifies whether vTPM should be enabled on the virtual machine. Minimum api-version: 2020-12-01. VTpmEnabled *bool } @@ -6752,17 +6776,16 @@ type UserAssignedIdentitiesValue struct { PrincipalID *string } -// VMDiskSecurityProfile - Specifies the security profile settings for the managed disk. -// NOTE: It can only be set for Confidential VMs +// VMDiskSecurityProfile - Specifies the security profile settings for the managed disk. Note: It can only be set for Confidential +// VMs. type VMDiskSecurityProfile struct { // Specifies the customer managed disk encryption set resource id for the managed disk that is used for Customer Managed Key // encrypted ConfidentialVM OS Disk and VMGuest blob. DiskEncryptionSet *DiskEncryptionSetParameters - // Specifies the EncryptionType of the managed disk. - // It is set to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, and VMGuestStateOnly - // for encryption of just the VMGuestState blob. - // NOTE: It can be set for only Confidential VMs. + // Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for encryption of the managed disk + // along with VMGuestState blob, and VMGuestStateOnly for encryption of just the + // VMGuestState blob. Note: It can be set for only Confidential VMs. SecurityEncryptionType *SecurityEncryptionTypes } @@ -6807,16 +6830,14 @@ type VMScaleSetConvertToSinglePlacementGroupInput struct { // VMSizeProperties - Specifies VM Size Property settings on the virtual machine. type VMSizeProperties struct { - // Specifies the number of vCPUs available for the VM. - // When this property is not specified in the request body the default behavior is to set it to the value of vCPUs available - // for that VM size exposed in api response of List all available virtual machine - // sizes in a region [https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list] . + // Specifies the number of vCPUs available for the VM. When this property is not specified in the request body the default + // behavior is to set it to the value of vCPUs available for that VM size exposed + // in api response of List all available virtual machine sizes in a region [https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list]. VCPUsAvailable *int32 - // Specifies the vCPU to physical core ratio. - // When this property is not specified in the request body the default behavior is set to the value of vCPUsPerCore for the - // VM Size exposed in api response of List all available virtual machine sizes in - // a region [https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list] + // Specifies the vCPU to physical core ratio. When this property is not specified in the request body the default behavior + // is set to the value of vCPUsPerCore for the VM Size exposed in api response of + // List all available virtual machine sizes in a region [https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list]. // Setting this property to 1 also means that hyper-threading is disabled. VCPUsPerCore *int32 } @@ -6825,10 +6846,10 @@ type VMSizeProperties struct { // the VM. type VaultCertificate struct { // For Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified - // certificate store is implicitly in the LocalMachine account. - // For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name .crt - // for the X509 certificate file and .prv for private - // key. Both of these files are .pem formatted. + // certificate store is implicitly in the LocalMachine account. For Linux + // VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name .crt + // for the X509 certificate file and .prv for private key. Both + // of these files are .pem formatted. CertificateStore *string // This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, @@ -7112,6 +7133,9 @@ type VirtualMachineExtensionProperties struct { // The extensions protected settings that are passed by reference, and consumed from key vault ProtectedSettingsFromKeyVault *KeyVaultSecretReference + // Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions []*string + // The name of the extension handler publisher. Publisher *string @@ -7463,9 +7487,9 @@ type VirtualMachineInstallPatchesResult struct { // VirtualMachineInstanceView - The instance view of a virtual machine. type VirtualMachineInstanceView struct { - // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. - // You can easily view the output of your console log. - // Azure also enables you to see a screenshot of the VM from the hypervisor. + // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. You + // can easily view the output of your console log. Azure also enables you to see + // a screenshot of the VM from the hypervisor. BootDiagnostics *BootDiagnosticsInstanceView // The computer name assigned to the virtual machine. @@ -7509,8 +7533,7 @@ type VirtualMachineInstanceView struct { // READ-ONLY; Resource id of the dedicated host, on which the virtual machine is allocated through automatic placement, when // the virtual machine is associated with a dedicated host group that has automatic - // placement enabled. - // Minimum api-version: 2020-06-01. + // placement enabled. Minimum api-version: 2020-06-01. AssignedHost *string // READ-ONLY; The health status for the VM. @@ -7628,52 +7651,47 @@ type VirtualMachineProperties struct { // Specifies additional capabilities enabled or disabled on the virtual machine. AdditionalCapabilities *AdditionalCapabilities - // Specifies the gallery applications that should be made available to the VM/VMSS + // Specifies the gallery applications that should be made available to the VM/VMSS. ApplicationProfile *ApplicationProfile // Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified // in the same availability set are allocated to different nodes to maximize // availability. For more information about availability sets, see Availability sets overview [https://docs.microsoft.com/azure/virtual-machines/availability-set-overview]. - // For more information on Azure planned maintenance, see Maintenance and updates for Virtual Machines in Azure [https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates] - // Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added - // should be under the same resource group as the availability set resource. An - // existing VM cannot be added to an availability set. - // This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. + // For more information on Azure + // planned maintenance, see Maintenance and updates for Virtual Machines in Azure [https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates]. + // Currently, a VM can only be added to + // availability set at creation time. The availability set to which the VM is being added should be under the same resource + // group as the availability set resource. An existing VM cannot be added to an + // availability set. This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. AvailabilitySet *SubResource - // Specifies the billing related details of a Azure Spot virtual machine. - // Minimum api-version: 2019-03-01. + // Specifies the billing related details of a Azure Spot virtual machine. Minimum api-version: 2019-03-01. BillingProfile *BillingProfile - // Specifies information about the capacity reservation that is used to allocate virtual machine. - // Minimum api-version: 2021-04-01. + // Specifies information about the capacity reservation that is used to allocate virtual machine. Minimum api-version: 2021-04-01. CapacityReservation *CapacityReservationProfile - // Specifies the boot diagnostic settings state. - // Minimum api-version: 2015-06-15. + // Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. DiagnosticsProfile *DiagnosticsProfile - // Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. - // For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. - // For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + // Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For Azure Spot virtual machines, + // both 'Deallocate' and 'Delete' are supported and the minimum api-version is + // 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. EvictionPolicy *VirtualMachineEvictionPolicyTypes // Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes // (inclusive) and should be specified in ISO 8601 format. The default value is 90 - // minutes (PT1H30M). - // Minimum api-version: 2020-06-01 + // minutes (PT1H30M). Minimum api-version: 2020-06-01. ExtensionsTimeBudget *string // Specifies the hardware settings for the virtual machine. HardwareProfile *HardwareProfile - // Specifies information about the dedicated host that the virtual machine resides in. - // Minimum api-version: 2018-10-01. + // Specifies information about the dedicated host that the virtual machine resides in. Minimum api-version: 2018-10-01. Host *SubResource - // Specifies information about the dedicated host group that the virtual machine resides in. - // Minimum api-version: 2020-06-01. - // NOTE: User cannot specify both host and hostGroup properties. + // Specifies information about the dedicated host group that the virtual machine resides in. Note: User cannot specify both + // host and hostGroup properties. Minimum api-version: 2020-06-01. HostGroup *SubResource // Specifies that the image or disk that is being used was licensed on-premises. @@ -7697,20 +7715,18 @@ type VirtualMachineProperties struct { // Specifies the scale set logical fault domain into which the Virtual Machine will be created. By default, the Virtual Machine // will by automatically assigned to a fault domain that best maintains - // balance across available fault domains. - // This is applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set.The Virtual Machine Scale - // Set that is referenced, must have 'platformFaultDomainCount' > 1.This property - // cannot be updated once the Virtual Machine is created.Fault domain assignment can be viewed in the Virtual Machine Instance - // View. - // Minimum api‐version: 2020‐12‐01 + // balance across available fault domains. This is applicable only if the 'virtualMachineScaleSet' property of this Virtual + // Machine is set. The Virtual Machine Scale Set that is referenced, must have + // 'platformFaultDomainCount' greater than 1. This property cannot be updated once the Virtual Machine is created. Fault domain + // assignment can be viewed in the Virtual Machine Instance View. Minimum + // api‐version: 2020‐12‐01. PlatformFaultDomain *int32 - // Specifies the priority for the virtual machine. - // Minimum api-version: 2019-03-01 + // Specifies the priority for the virtual machine. Minimum api-version: 2019-03-01 Priority *VirtualMachinePriorityTypes - // Specifies information about the proximity placement group that the virtual machine should be assigned to. - // Minimum api-version: 2018-04-01. + // Specifies information about the proximity placement group that the virtual machine should be assigned to. Minimum api-version: + // 2018-04-01. ProximityPlacementGroup *SubResource // Specifies Scheduled Event related configurations. @@ -7722,16 +7738,15 @@ type VirtualMachineProperties struct { // Specifies the storage settings for the virtual machine disks. StorageProfile *StorageProfile - // UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. - // Minimum api-version: 2021-03-01 + // UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. Minimum api-version: + // 2021-03-01. UserData *string // Specifies information about the virtual machine scale set that the virtual machine should be assigned to. Virtual machines // specified in the same virtual machine scale set are allocated to different // nodes to maximize availability. Currently, a VM can only be added to virtual machine scale set at creation time. An existing - // VM cannot be added to a virtual machine scale set. - // This property cannot exist along with a non-null properties.availabilitySet reference. - // Minimum api‐version: 2019‐03‐01 + // VM cannot be added to a virtual machine scale set. This property cannot + // exist along with a non-null properties.availabilitySet reference. Minimum api‐version: 2019‐03‐01. VirtualMachineScaleSet *SubResource // READ-ONLY; The virtual machine instance view. @@ -7740,8 +7755,7 @@ type VirtualMachineProperties struct { // READ-ONLY; The provisioning state, which only appears in the response. ProvisioningState *string - // READ-ONLY; Specifies the time at which the Virtual Machine resource was created. - // Minimum api-version: 2021-11-01. + // READ-ONLY; Specifies the time at which the Virtual Machine resource was created. Minimum api-version: 2021-11-01. TimeCreated *time.Time // READ-ONLY; Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS @@ -7862,10 +7876,28 @@ type VirtualMachineRunCommandProperties struct { // Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. AsyncExecution *bool - // Specifies the Azure storage blob where script error stream will be uploaded. + // User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned + // identity. Make sure managed identity has been given access to blob's + // container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it + // under VM's identity. For more info on managed identity and Run Command, refer + // https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged + ErrorBlobManagedIdentity *RunCommandManagedIdentity + + // Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write + // access OR use managed identity to provide the VM access to the blob. Refer + // errorBlobManagedIdentity parameter. ErrorBlobURI *string - // Specifies the Azure storage blob where script output stream will be uploaded. + // User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned + // identity. Make sure managed identity has been given access to blob's + // container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it + // under VM's identity. For more info on managed identity and Run Command, refer + // https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged + OutputBlobManagedIdentity *RunCommandManagedIdentity + + // Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, + // write access OR use managed identity to provide the VM access to the blob. Refer + // outputBlobManagedIdentity parameter. OutputBlobURI *string // The parameters used by the script. @@ -7886,14 +7918,27 @@ type VirtualMachineRunCommandProperties struct { // The timeout in seconds to execute the run command. TimeoutInSeconds *int32 + // Optional. If set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. + // If set to false, ProvisioningState would only reflect whether the run + // command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. + // See instance view of run command in case of script failures to see + // executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results + TreatFailureAsDeploymentFailure *bool + // READ-ONLY; The virtual machine run command instance view. InstanceView *VirtualMachineRunCommandInstanceView - // READ-ONLY; The provisioning state, which only appears in the response. + // READ-ONLY; The provisioning state, which only appears in the response. If treatFailureAsDeploymentFailure set to true, + // any failure in the script will fail the deployment and ProvisioningState will be marked as + // Failed. If treatFailureAsDeploymentFailure set to false, ProvisioningState would only reflect whether the run command was + // run or not by the extensions platform, it would not indicate whether script + // failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, + // output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results ProvisioningState *string } -// VirtualMachineRunCommandScriptSource - Describes the script sources for run command. +// VirtualMachineRunCommandScriptSource - Describes the script sources for run command. Use only one of script, scriptUri, +// commandId. type VirtualMachineRunCommandScriptSource struct { // Specifies a commandId of predefined built-in script. CommandID *string @@ -7901,8 +7946,15 @@ type VirtualMachineRunCommandScriptSource struct { // Specifies the script content to be executed on the VM. Script *string - // Specifies the script download location. + // Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI. ScriptURI *string + + // User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case + // of system-assigned identity. Make sure the Azure storage blob exists, and managed + // identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned + // identity, make sure you add it under VM's identity. For more info on + // managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. + ScriptURIManagedIdentity *RunCommandManagedIdentity } // VirtualMachineRunCommandUpdate - Describes a Virtual Machine run command. @@ -8019,12 +8071,8 @@ type VirtualMachineScaleSetDataDisk struct { // therefore must be unique for each data disk attached to a VM. Lun *int32 - // Specifies the caching requirements. - // Possible values are: - // None - // ReadOnly - // ReadWrite - // Default: None for Standard storage. ReadOnly for Premium storage + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. Caching *CachingTypes // Specifies whether data disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with @@ -8044,8 +8092,8 @@ type VirtualMachineScaleSetDataDisk struct { DiskMBpsReadWrite *int64 // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a - // virtual machine image. - // diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023 + // virtual machine image. The property diskSizeGB is the number of bytes x 1024^3 + // for the disk and the value cannot be larger than 1023. DiskSizeGB *int32 // The managed disk parameters. @@ -8090,8 +8138,7 @@ type VirtualMachineScaleSetExtensionProfile struct { // Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes // (inclusive) and should be specified in ISO 8601 format. The default value is 90 - // minutes (PT1H30M). - // Minimum api-version: 2020-06-01 + // minutes (PT1H30M). Minimum api-version: 2020-06-01. ExtensionsTimeBudget *string } @@ -8190,8 +8237,9 @@ type VirtualMachineScaleSetExtensionsClientListOptions struct { // VirtualMachineScaleSetHardwareProfile - Specifies the hardware settings for the virtual machine scale set. type VirtualMachineScaleSetHardwareProfile struct { - // Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-11-01. - // Please follow the instructions in VM Customization [https://aka.ms/vmcustomization] for more details. + // Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-11-01. Please follow + // the instructions in VM Customization [https://aka.ms/vmcustomization] for more + // details. VMSizeProperties *VMSizeProperties } @@ -8200,9 +8248,6 @@ type VirtualMachineScaleSetIPConfiguration struct { // REQUIRED; The IP configuration name. Name *string - // Resource Id - ID *string - // Describes a virtual machine scale set network profile's IP configuration properties. Properties *VirtualMachineScaleSetIPConfigurationProperties } @@ -8350,9 +8395,6 @@ type VirtualMachineScaleSetNetworkConfiguration struct { // REQUIRED; The network configuration name. Name *string - // Resource Id - ID *string - // Describes a virtual machine scale set network profile's IP configuration. Properties *VirtualMachineScaleSetNetworkConfigurationProperties } @@ -8411,18 +8453,14 @@ type VirtualMachineScaleSetNetworkProfile struct { // VirtualMachineScaleSetOSDisk - Describes a virtual machine scale set operating system disk. type VirtualMachineScaleSetOSDisk struct { - // REQUIRED; Specifies how the virtual machines in the scale set should be created. - // The only allowed value is: FromImage \u2013 This value is used when you are using an image to create the virtual machine. - // If you are using a platform image, you also use the imageReference element - // described above. If you are using a marketplace image, you also use the plan element previously described. + // REQUIRED; Specifies how the virtual machines in the scale set should be created. The only allowed value is: FromImage. + // This value is used when you are using an image to create the virtual machine. If you are + // using a platform image, you also use the imageReference element described above. If you are using a marketplace image, + // you also use the plan element previously described. CreateOption *DiskCreateOptionTypes - // Specifies the caching requirements. - // Possible values are: - // None - // ReadOnly - // ReadWrite - // Default: None for Standard storage. ReadOnly for Premium storage + // Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard + // storage. ReadOnly for Premium storage. Caching *CachingTypes // Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with @@ -8438,8 +8476,8 @@ type VirtualMachineScaleSetOSDisk struct { DiffDiskSettings *DiffDiskSettings // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a - // virtual machine image. - // diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023 + // virtual machine image. The property 'diskSizeGB' is the number of bytes x 1024^3 + // for the disk and the value cannot be larger than 1023. DiskSizeGB *int32 // Specifies information about the unmanaged user image to base the scale set on. @@ -8452,10 +8490,7 @@ type VirtualMachineScaleSetOSDisk struct { Name *string // This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or - // a specialized VHD. - // Possible values are: - // Windows - // Linux + // a specialized VHD. Possible values are: Windows, Linux. OSType *OperatingSystemTypes // Specifies the container urls that are used to store operating system disks for the scale set. @@ -8494,8 +8529,8 @@ type VirtualMachineScaleSetOSProfile struct { // Max-length (Windows): 20 characters AdminUsername *string - // Specifies whether extension operations should be allowed on the virtual machine scale set. - // This may only be set to False when no extensions are present on the virtual machine scale set. + // Specifies whether extension operations should be allowed on the virtual machine scale set. This may only be set to False + // when no extensions are present on the virtual machine scale set. AllowExtensionOperations *bool // Specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to @@ -8504,12 +8539,12 @@ type VirtualMachineScaleSetOSProfile struct { // Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved // as a file on the Virtual Machine. The maximum length of the binary array is - // 65535 bytes. - // For using cloud-init for your VM, see Using cloud-init to customize a Linux VM during creation [https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init] + // 65535 bytes. For using cloud-init for your VM, see Using cloud-init to customize a Linux VM during creation [https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init] CustomData *string - // Specifies the Linux operating system settings on the virtual machine. - // For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. + // Specifies the Linux operating system settings on the virtual machine. For a list of supported Linux distributions, see + // Linux on Azure-Endorsed Distributions + // [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. LinuxConfiguration *LinuxConfiguration // Optional property which must either be set to True or omitted. @@ -8544,8 +8579,8 @@ type VirtualMachineScaleSetProperties struct { // overprovisioned VMs. DoNotRunExtensionsOnOverprovisionedVMs *bool - // Specifies information about the dedicated host group that the virtual machine scale set resides in. - // Minimum api-version: 2020-06-01. + // Specifies information about the dedicated host group that the virtual machine scale set resides in. Minimum api-version: + // 2020-06-01. HostGroup *SubResource // Specifies the orchestration mode for the virtual machine scale set. @@ -8560,8 +8595,8 @@ type VirtualMachineScaleSetProperties struct { // Specifies the desired targets for mixing Spot and Regular priority VMs within the same VMSS Flex instance. PriorityMixPolicy *PriorityMixPolicy - // Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. - // Minimum api-version: 2018-04-01. + // Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. Minimum + // api-version: 2018-04-01. ProximityPlacementGroup *SubResource // Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale Set. @@ -8589,8 +8624,7 @@ type VirtualMachineScaleSetProperties struct { // READ-ONLY; The provisioning state, which only appears in the response. ProvisioningState *string - // READ-ONLY; Specifies the time at which the Virtual Machine Scale Set resource was created. - // Minimum api-version: 2021-11-01. + // READ-ONLY; Specifies the time at which the Virtual Machine Scale Set resource was created. Minimum api-version: 2021-11-01. TimeCreated *time.Time // READ-ONLY; Specifies the ID which uniquely identifies a Virtual Machine Scale Set. @@ -8715,8 +8749,9 @@ type VirtualMachineScaleSetSKUCapacity struct { // VirtualMachineScaleSetStorageProfile - Describes a virtual machine scale set storage profile. type VirtualMachineScaleSetStorageProfile struct { - // Specifies the parameters that are used to add data disks to the virtual machines in the scale set. - // For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + // Specifies the parameters that are used to add data disks to the virtual machines in the scale set. For more information + // about disks, see About disks and VHDs for Azure virtual machines + // [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. DataDisks []*VirtualMachineScaleSetDataDisk DiskControllerType *string @@ -8725,8 +8760,9 @@ type VirtualMachineScaleSetStorageProfile struct { // image, marketplace image, or virtual machine image, but is not used in other creation operations. ImageReference *ImageReference - // Specifies information about the operating system disk used by the virtual machines in the scale set. - // For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + // Specifies information about the operating system disk used by the virtual machines in the scale set. For more information + // about disks, see About disks and VHDs for Azure virtual machines + // [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. OSDisk *VirtualMachineScaleSetOSDisk } @@ -8752,9 +8788,6 @@ type VirtualMachineScaleSetUpdate struct { // NOTE: The subnet of a scale set may be modified as long as the original subnet and the new subnet are in the same virtual // network type VirtualMachineScaleSetUpdateIPConfiguration struct { - // Resource Id - ID *string - // The IP configuration name. Name *string @@ -8793,9 +8826,6 @@ type VirtualMachineScaleSetUpdateIPConfigurationProperties struct { // VirtualMachineScaleSetUpdateNetworkConfiguration - Describes a virtual machine scale set network profile's network configurations. type VirtualMachineScaleSetUpdateNetworkConfiguration struct { - // Resource Id - ID *string - // The network configuration name. Name *string @@ -8918,6 +8948,9 @@ type VirtualMachineScaleSetUpdateProperties struct { // Specifies whether the Virtual Machine Scale Set should be overprovisioned. Overprovision *bool + // Specifies the desired targets for mixing Spot and Regular priority VMs within the same VMSS Flex instance. + PriorityMixPolicy *PriorityMixPolicy + // Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. // Minimum api-version: 2018-04-01. ProximityPlacementGroup *SubResource @@ -8930,6 +8963,9 @@ type VirtualMachineScaleSetUpdateProperties struct { // is false, it may not be modified to true. SinglePlacementGroup *bool + // Specifies the Spot Restore properties for the virtual machine scale set. + SpotRestorePolicy *SpotRestorePolicy + // The upgrade policy. UpgradePolicy *UpgradePolicy @@ -8978,8 +9014,7 @@ type VirtualMachineScaleSetUpdateStorageProfile struct { // VirtualMachineScaleSetUpdateVMProfile - Describes a virtual machine scale set virtual machine profile. type VirtualMachineScaleSetUpdateVMProfile struct { - // Specifies the billing related details of a Azure Spot VMSS. - // Minimum api-version: 2019-03-01. + // Specifies the billing related details of a Azure Spot VMSS. Minimum api-version: 2019-03-01. BillingProfile *BillingProfile // The virtual machine scale set diagnostics profile. @@ -8988,8 +9023,7 @@ type VirtualMachineScaleSetUpdateVMProfile struct { // The virtual machine scale set extension profile. ExtensionProfile *VirtualMachineScaleSetExtensionProfile - // Specifies the hardware profile related details of a scale set. - // Minimum api-version: 2021-11-01. + // Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01. HardwareProfile *VirtualMachineScaleSetHardwareProfile // The license type, which is for bring your own license scenario. @@ -9060,6 +9094,9 @@ type VirtualMachineScaleSetVM struct { // VirtualMachineScaleSetVMExtension - Describes a VMSS VM Extension. type VirtualMachineScaleSetVMExtension struct { + // The location of the extension. + Location *string + // Describes the properties of a Virtual Machine Extension. Properties *VirtualMachineExtensionProperties @@ -9153,9 +9190,9 @@ type VirtualMachineScaleSetVMInstanceRequiredIDs struct { // VirtualMachineScaleSetVMInstanceView - The instance view of a virtual machine scale set VM. type VirtualMachineScaleSetVMInstanceView struct { - // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. - // You can easily view the output of your console log. - // Azure also enables you to see a screenshot of the VM from the hypervisor. + // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. You + // can easily view the output of your console log. Azure also enables you to see + // a screenshot of the VM from the hypervisor. BootDiagnostics *BootDiagnosticsInstanceView // Specifies the host OS name of the virtual machine. @@ -9204,8 +9241,7 @@ type VirtualMachineScaleSetVMInstanceView struct { // READ-ONLY; Resource id of the dedicated host, on which the virtual machine is allocated through automatic placement, when // the virtual machine is associated with a dedicated host group that has automatic - // placement enabled. - // Minimum api-version: 2020-06-01. + // placement enabled. Minimum api-version: 2020-06-01. AssignedHost *string // READ-ONLY; The health status for the VM. @@ -9233,28 +9269,24 @@ type VirtualMachineScaleSetVMProfile struct { // Specifies the gallery applications that should be made available to the VM/VMSS ApplicationProfile *ApplicationProfile - // Specifies the billing related details of a Azure Spot VMSS. - // Minimum api-version: 2019-03-01. + // Specifies the billing related details of a Azure Spot VMSS. Minimum api-version: 2019-03-01. BillingProfile *BillingProfile - // Specifies the capacity reservation related details of a scale set. - // Minimum api-version: 2021-04-01. + // Specifies the capacity reservation related details of a scale set. Minimum api-version: 2021-04-01. CapacityReservation *CapacityReservationProfile - // Specifies the boot diagnostic settings state. - // Minimum api-version: 2015-06-15. + // Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. DiagnosticsProfile *DiagnosticsProfile - // Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. - // For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. - // For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + // Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For Azure Spot virtual machines, + // both 'Deallocate' and 'Delete' are supported and the minimum api-version is + // 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. EvictionPolicy *VirtualMachineEvictionPolicyTypes // Specifies a collection of settings for extensions installed on virtual machines in the scale set. ExtensionProfile *VirtualMachineScaleSetExtensionProfile - // Specifies the hardware profile related details of a scale set. - // Minimum api-version: 2021-11-01. + // Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01. HardwareProfile *VirtualMachineScaleSetHardwareProfile // Specifies that the image or disk that is being used was licensed on-premises. @@ -9275,13 +9307,15 @@ type VirtualMachineScaleSetVMProfile struct { // Specifies the operating system settings for the virtual machines in the scale set. OSProfile *VirtualMachineScaleSetOSProfile - // Specifies the priority for the virtual machines in the scale set. - // Minimum api-version: 2017-10-30-preview + // Specifies the priority for the virtual machines in the scale set. Minimum api-version: 2017-10-30-preview. Priority *VirtualMachinePriorityTypes // Specifies Scheduled Event related configurations. ScheduledEventsProfile *ScheduledEventsProfile + // Specifies the security posture to be used for all virtual machines in the scale set. Minimum api-version: 2023-03-01 + SecurityPostureReference *SecurityPostureReference + // Specifies the Security related profile settings for the virtual machines in the scale set. SecurityProfile *SecurityProfile @@ -9293,8 +9327,7 @@ type VirtualMachineScaleSetVMProfile struct { StorageProfile *VirtualMachineScaleSetStorageProfile // UserData for the virtual machines in the scale set, which must be base-64 encoded. Customer should not pass any secrets - // in here. - // Minimum api-version: 2021-03-01 + // in here. Minimum api-version: 2021-03-01. UserData *string } @@ -9308,13 +9341,13 @@ type VirtualMachineScaleSetVMProperties struct { // Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified // in the same availability set are allocated to different nodes to maximize // availability. For more information about availability sets, see Availability sets overview [https://docs.microsoft.com/azure/virtual-machines/availability-set-overview]. - // For more information on Azure planned maintenance, see Maintenance and updates for Virtual Machines in Azure [https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates] - // Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability - // set. + // For more information on Azure + // planned maintenance, see Maintenance and updates for Virtual Machines in Azure [https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates]. + // Currently, a VM can only be added to + // availability set at creation time. An existing VM cannot be added to an availability set. AvailabilitySet *SubResource - // Specifies the boot diagnostic settings state. - // Minimum api-version: 2015-06-15. + // Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. DiagnosticsProfile *DiagnosticsProfile // Specifies the hardware settings for the virtual machine. @@ -9544,8 +9577,8 @@ type VirtualMachineScaleSetVMsClientListOptions struct { // VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.RetrieveBootDiagnosticsData // method. type VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions struct { - // Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. - // NOTE: If not specified, SAS URIs will be generated with a default expiration duration of 120 minutes. + // Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. Note: If not specified, SAS URIs + // will be generated with a default expiration duration of 120 minutes. SasURIExpirationTimeInMinutes *int32 } @@ -9565,6 +9598,9 @@ type VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions struct { // VirtualMachineScaleSetsClientBeginDeallocateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDeallocate // method. type VirtualMachineScaleSetsClientBeginDeallocateOptions struct { + // Optional parameter to hibernate a virtual machine from the VM scale set. (This feature is available for VMSS with Flexible + // OrchestrationMode only) + Hibernate *bool // Resumes the LRO from the provided token. ResumeToken string // A list of virtual machine instance IDs from the VM scale set. @@ -9610,6 +9646,13 @@ type VirtualMachineScaleSetsClientBeginPowerOffOptions struct { VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs } +// VirtualMachineScaleSetsClientBeginReapplyOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReapply +// method. +type VirtualMachineScaleSetsClientBeginReapplyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // VirtualMachineScaleSetsClientBeginRedeployOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginRedeploy // method. type VirtualMachineScaleSetsClientBeginRedeployOptions struct { @@ -9968,6 +10011,9 @@ type VirtualMachinesClientInstanceViewOptions struct { // VirtualMachinesClientListAllOptions contains the optional parameters for the VirtualMachinesClient.NewListAllPager method. type VirtualMachinesClientListAllOptions struct { + // The expand expression to apply on operation. 'instanceView' enables fetching run time status of all Virtual Machines, this + // can only be specified if a valid $filter option is specified + Expand *ExpandTypesForListVMs // The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' Filter *string @@ -9989,6 +10035,9 @@ type VirtualMachinesClientListByLocationOptions struct { // VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.NewListPager method. type VirtualMachinesClientListOptions struct { + // The expand expression to apply on operation. 'instanceView' enables fetching run time status of all Virtual Machines, this + // can only be specified if a valid $filter option is specified + Expand *ExpandTypeForListVMs // The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' Filter *string @@ -9997,8 +10046,8 @@ type VirtualMachinesClientListOptions struct { // VirtualMachinesClientRetrieveBootDiagnosticsDataOptions contains the optional parameters for the VirtualMachinesClient.RetrieveBootDiagnosticsData // method. type VirtualMachinesClientRetrieveBootDiagnosticsDataOptions struct { - // Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. - // NOTE: If not specified, SAS URIs will be generated with a default expiration duration of 120 minutes. + // Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. Note: If not specified, SAS URIs + // will be generated with a default expiration duration of 120 minutes. SasURIExpirationTimeInMinutes *int32 } @@ -10018,8 +10067,8 @@ type WinRMConfiguration struct { type WinRMListener struct { // This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, // see Add a key or secret to the key vault - // [https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add]. In this case, your certificate needs to be It - // is the Base64 encoding of the following JSON Object which is encoded in UTF-8: + // [https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add]. In this case, your certificate needs to be the + // Base64 encoding of the following JSON Object which is encoded in UTF-8: // { // "data":"", // "dataType":"pfx", @@ -10032,10 +10081,7 @@ type WinRMListener struct { // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. CertificateURL *string - // Specifies the protocol of WinRM listener. - // Possible values are: - // http - // https + // Specifies the protocol of WinRM listener. Possible values are: http, https. Protocol *ProtocolTypes } @@ -10045,8 +10091,9 @@ type WindowsConfiguration struct { // used by Windows Setup. AdditionalUnattendContent []*AdditionalUnattendContent - // Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true. - // For virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning. + // Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true. For virtual machine + // scale sets, this property can be updated and updates will take effect on OS + // reprovisioning. EnableAutomaticUpdates *bool // Indicates whether VMAgent Platform Updates is enabled for the Windows virtual machine. Default value is false. @@ -10055,14 +10102,14 @@ type WindowsConfiguration struct { // [Preview Feature] Specifies settings related to VM Guest Patching on Windows. PatchSettings *PatchSettings - // Indicates whether virtual machine agent should be provisioned on the virtual machine. - // When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM + // Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified + // in the request body, it is set to true by default. This will ensure that VM // Agent is installed on the VM so that extensions can be added to the VM later. ProvisionVMAgent *bool - // Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". - // Possible values can be TimeZoneInfo.Id [https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id] - // value from time zones returned by TimeZoneInfo.GetSystemTimeZones + // Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". Possible values can be TimeZoneInfo.Id + // [https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id] value from time zones returned by + // TimeZoneInfo.GetSystemTimeZones // [https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones]. TimeZone *string @@ -10091,6 +10138,9 @@ type WindowsParameters struct { // WindowsVMGuestPatchAutomaticByPlatformSettings - Specifies additional settings to be applied when patch mode AutomaticByPlatform // is selected in Windows patch settings. type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + // Enables customer to schedule patching without accidental upgrades + BypassPlatformSafetyChecksOnUserSchedule *bool + // Specifies the reboot setting for all AutomaticByPlatform patch installation operations. RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting } diff --git a/sdk/resourcemanager/compute/armcompute/models_serde.go b/sdk/resourcemanager/compute/armcompute/models_serde.go index b1734e9e6023..e3e45beeba1a 100644 --- a/sdk/resourcemanager/compute/armcompute/models_serde.go +++ b/sdk/resourcemanager/compute/armcompute/models_serde.go @@ -2911,10 +2911,38 @@ func (d *DedicatedHostProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostSizeListResult. +func (d DedicatedHostSizeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostSizeListResult. +func (d *DedicatedHostSizeListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DedicatedHostUpdate. func (d DedicatedHostUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) populate(objectMap, "tags", d.Tags) return json.Marshal(objectMap) } @@ -2931,6 +2959,9 @@ func (d *DedicatedHostUpdate) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) @@ -3801,6 +3832,41 @@ func (d *DiskRestorePoint) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DiskRestorePointAttributes. +func (d DiskRestorePointAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "encryption", d.Encryption) + populate(objectMap, "id", d.ID) + populate(objectMap, "sourceDiskRestorePoint", d.SourceDiskRestorePoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointAttributes. +func (d *DiskRestorePointAttributes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "encryption": + err = unpopulate(val, "Encryption", &d.Encryption) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "sourceDiskRestorePoint": + err = unpopulate(val, "SourceDiskRestorePoint", &d.SourceDiskRestorePoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DiskRestorePointInstanceView. func (d DiskRestorePointInstanceView) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7215,6 +7281,7 @@ func (l *LinuxPatchSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LinuxVMGuestPatchAutomaticByPlatformSettings. func (l LinuxVMGuestPatchAutomaticByPlatformSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "bypassPlatformSafetyChecksOnUserSchedule", l.BypassPlatformSafetyChecksOnUserSchedule) populate(objectMap, "rebootSetting", l.RebootSetting) return json.Marshal(objectMap) } @@ -7228,6 +7295,9 @@ func (l *LinuxVMGuestPatchAutomaticByPlatformSettings) UnmarshalJSON(data []byte for key, val := range rawMsg { var err error switch key { + case "bypassPlatformSafetyChecksOnUserSchedule": + err = unpopulate(val, "BypassPlatformSafetyChecksOnUserSchedule", &l.BypassPlatformSafetyChecksOnUserSchedule) + delete(rawMsg, key) case "rebootSetting": err = unpopulate(val, "RebootSetting", &l.RebootSetting) delete(rawMsg, key) @@ -10330,6 +10400,37 @@ func (r *RestorePointCollectionUpdate) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type RestorePointEncryption. +func (r RestorePointEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskEncryptionSet", r.DiskEncryptionSet) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointEncryption. +func (r *RestorePointEncryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionSet": + err = unpopulate(val, "DiskEncryptionSet", &r.DiskEncryptionSet) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type RestorePointInstanceView. func (r RestorePointInstanceView) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10417,6 +10518,7 @@ func (r RestorePointSourceMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "diagnosticsProfile", r.DiagnosticsProfile) populate(objectMap, "hardwareProfile", r.HardwareProfile) + populate(objectMap, "hyperVGeneration", r.HyperVGeneration) populate(objectMap, "licenseType", r.LicenseType) populate(objectMap, "location", r.Location) populate(objectMap, "osProfile", r.OSProfile) @@ -10442,6 +10544,9 @@ func (r *RestorePointSourceMetadata) UnmarshalJSON(data []byte) error { case "hardwareProfile": err = unpopulate(val, "HardwareProfile", &r.HardwareProfile) delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &r.HyperVGeneration) + delete(rawMsg, key) case "licenseType": err = unpopulate(val, "LicenseType", &r.LicenseType) delete(rawMsg, key) @@ -10480,6 +10585,7 @@ func (r RestorePointSourceVMDataDisk) MarshalJSON() ([]byte, error) { populate(objectMap, "lun", r.Lun) populate(objectMap, "managedDisk", r.ManagedDisk) populate(objectMap, "name", r.Name) + populate(objectMap, "writeAcceleratorEnabled", r.WriteAcceleratorEnabled) return json.Marshal(objectMap) } @@ -10510,6 +10616,9 @@ func (r *RestorePointSourceVMDataDisk) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &r.WriteAcceleratorEnabled) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -10528,6 +10637,7 @@ func (r RestorePointSourceVMOSDisk) MarshalJSON() ([]byte, error) { populate(objectMap, "managedDisk", r.ManagedDisk) populate(objectMap, "name", r.Name) populate(objectMap, "osType", r.OSType) + populate(objectMap, "writeAcceleratorEnabled", r.WriteAcceleratorEnabled) return json.Marshal(objectMap) } @@ -10561,6 +10671,9 @@ func (r *RestorePointSourceVMOSDisk) UnmarshalJSON(data []byte) error { case "osType": err = unpopulate(val, "OSType", &r.OSType) delete(rawMsg, key) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &r.WriteAcceleratorEnabled) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -11282,6 +11395,37 @@ func (r *RunCommandListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type RunCommandManagedIdentity. +func (r RunCommandManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", r.ClientID) + populate(objectMap, "objectId", r.ObjectID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandManagedIdentity. +func (r *RunCommandManagedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &r.ClientID) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &r.ObjectID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type RunCommandParameterDefinition. func (r RunCommandParameterDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -11674,6 +11818,37 @@ func (s *ScheduledEventsProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SecurityPostureReference. +func (s SecurityPostureReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "excludeExtensions", s.ExcludeExtensions) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPostureReference. +func (s *SecurityPostureReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "excludeExtensions": + err = unpopulate(val, "ExcludeExtensions", &s.ExcludeExtensions) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SecurityProfile. func (s SecurityProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -14355,6 +14530,7 @@ func (v VirtualMachineExtensionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "instanceView", v.InstanceView) populateAny(objectMap, "protectedSettings", v.ProtectedSettings) populate(objectMap, "protectedSettingsFromKeyVault", v.ProtectedSettingsFromKeyVault) + populate(objectMap, "provisionAfterExtensions", v.ProvisionAfterExtensions) populate(objectMap, "provisioningState", v.ProvisioningState) populate(objectMap, "publisher", v.Publisher) populateAny(objectMap, "settings", v.Settings) @@ -14391,6 +14567,9 @@ func (v *VirtualMachineExtensionProperties) UnmarshalJSON(data []byte) error { case "protectedSettingsFromKeyVault": err = unpopulate(val, "ProtectedSettingsFromKeyVault", &v.ProtectedSettingsFromKeyVault) delete(rawMsg, key) + case "provisionAfterExtensions": + err = unpopulate(val, "ProvisionAfterExtensions", &v.ProvisionAfterExtensions) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) delete(rawMsg, key) @@ -15662,8 +15841,10 @@ func (v *VirtualMachineRunCommandInstanceView) UnmarshalJSON(data []byte) error func (v VirtualMachineRunCommandProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "asyncExecution", v.AsyncExecution) + populate(objectMap, "errorBlobManagedIdentity", v.ErrorBlobManagedIdentity) populate(objectMap, "errorBlobUri", v.ErrorBlobURI) populate(objectMap, "instanceView", v.InstanceView) + populate(objectMap, "outputBlobManagedIdentity", v.OutputBlobManagedIdentity) populate(objectMap, "outputBlobUri", v.OutputBlobURI) populate(objectMap, "parameters", v.Parameters) populate(objectMap, "protectedParameters", v.ProtectedParameters) @@ -15672,6 +15853,7 @@ func (v VirtualMachineRunCommandProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "runAsUser", v.RunAsUser) populate(objectMap, "source", v.Source) populate(objectMap, "timeoutInSeconds", v.TimeoutInSeconds) + populate(objectMap, "treatFailureAsDeploymentFailure", v.TreatFailureAsDeploymentFailure) return json.Marshal(objectMap) } @@ -15687,12 +15869,18 @@ func (v *VirtualMachineRunCommandProperties) UnmarshalJSON(data []byte) error { case "asyncExecution": err = unpopulate(val, "AsyncExecution", &v.AsyncExecution) delete(rawMsg, key) + case "errorBlobManagedIdentity": + err = unpopulate(val, "ErrorBlobManagedIdentity", &v.ErrorBlobManagedIdentity) + delete(rawMsg, key) case "errorBlobUri": err = unpopulate(val, "ErrorBlobURI", &v.ErrorBlobURI) delete(rawMsg, key) case "instanceView": err = unpopulate(val, "InstanceView", &v.InstanceView) delete(rawMsg, key) + case "outputBlobManagedIdentity": + err = unpopulate(val, "OutputBlobManagedIdentity", &v.OutputBlobManagedIdentity) + delete(rawMsg, key) case "outputBlobUri": err = unpopulate(val, "OutputBlobURI", &v.OutputBlobURI) delete(rawMsg, key) @@ -15717,6 +15905,9 @@ func (v *VirtualMachineRunCommandProperties) UnmarshalJSON(data []byte) error { case "timeoutInSeconds": err = unpopulate(val, "TimeoutInSeconds", &v.TimeoutInSeconds) delete(rawMsg, key) + case "treatFailureAsDeploymentFailure": + err = unpopulate(val, "TreatFailureAsDeploymentFailure", &v.TreatFailureAsDeploymentFailure) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -15731,6 +15922,7 @@ func (v VirtualMachineRunCommandScriptSource) MarshalJSON() ([]byte, error) { populate(objectMap, "commandId", v.CommandID) populate(objectMap, "script", v.Script) populate(objectMap, "scriptUri", v.ScriptURI) + populate(objectMap, "scriptUriManagedIdentity", v.ScriptURIManagedIdentity) return json.Marshal(objectMap) } @@ -15752,6 +15944,9 @@ func (v *VirtualMachineRunCommandScriptSource) UnmarshalJSON(data []byte) error case "scriptUri": err = unpopulate(val, "ScriptURI", &v.ScriptURI) delete(rawMsg, key) + case "scriptUriManagedIdentity": + err = unpopulate(val, "ScriptURIManagedIdentity", &v.ScriptURIManagedIdentity) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -16193,7 +16388,6 @@ func (v *VirtualMachineScaleSetHardwareProfile) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetIPConfiguration. func (v VirtualMachineScaleSetIPConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) return json.Marshal(objectMap) @@ -16208,9 +16402,6 @@ func (v *VirtualMachineScaleSetIPConfiguration) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -16578,7 +16769,6 @@ func (v *VirtualMachineScaleSetManagedDiskParameters) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetNetworkConfiguration. func (v VirtualMachineScaleSetNetworkConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) return json.Marshal(objectMap) @@ -16593,9 +16783,6 @@ func (v *VirtualMachineScaleSetNetworkConfiguration) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -17263,7 +17450,6 @@ func (v *VirtualMachineScaleSetUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateIPConfiguration. func (v VirtualMachineScaleSetUpdateIPConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) return json.Marshal(objectMap) @@ -17278,9 +17464,6 @@ func (v *VirtualMachineScaleSetUpdateIPConfiguration) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -17353,7 +17536,6 @@ func (v *VirtualMachineScaleSetUpdateIPConfigurationProperties) UnmarshalJSON(da // MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateNetworkConfiguration. func (v VirtualMachineScaleSetUpdateNetworkConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) return json.Marshal(objectMap) @@ -17368,9 +17550,6 @@ func (v *VirtualMachineScaleSetUpdateNetworkConfiguration) UnmarshalJSON(data [] for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -17576,9 +17755,11 @@ func (v VirtualMachineScaleSetUpdateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "automaticRepairsPolicy", v.AutomaticRepairsPolicy) populate(objectMap, "doNotRunExtensionsOnOverprovisionedVMs", v.DoNotRunExtensionsOnOverprovisionedVMs) populate(objectMap, "overprovision", v.Overprovision) + populate(objectMap, "priorityMixPolicy", v.PriorityMixPolicy) populate(objectMap, "proximityPlacementGroup", v.ProximityPlacementGroup) populate(objectMap, "scaleInPolicy", v.ScaleInPolicy) populate(objectMap, "singlePlacementGroup", v.SinglePlacementGroup) + populate(objectMap, "spotRestorePolicy", v.SpotRestorePolicy) populate(objectMap, "upgradePolicy", v.UpgradePolicy) populate(objectMap, "virtualMachineProfile", v.VirtualMachineProfile) return json.Marshal(objectMap) @@ -17605,6 +17786,9 @@ func (v *VirtualMachineScaleSetUpdateProperties) UnmarshalJSON(data []byte) erro case "overprovision": err = unpopulate(val, "Overprovision", &v.Overprovision) delete(rawMsg, key) + case "priorityMixPolicy": + err = unpopulate(val, "PriorityMixPolicy", &v.PriorityMixPolicy) + delete(rawMsg, key) case "proximityPlacementGroup": err = unpopulate(val, "ProximityPlacementGroup", &v.ProximityPlacementGroup) delete(rawMsg, key) @@ -17614,6 +17798,9 @@ func (v *VirtualMachineScaleSetUpdateProperties) UnmarshalJSON(data []byte) erro case "singlePlacementGroup": err = unpopulate(val, "SinglePlacementGroup", &v.SinglePlacementGroup) delete(rawMsg, key) + case "spotRestorePolicy": + err = unpopulate(val, "SpotRestorePolicy", &v.SpotRestorePolicy) + delete(rawMsg, key) case "upgradePolicy": err = unpopulate(val, "UpgradePolicy", &v.UpgradePolicy) delete(rawMsg, key) @@ -17879,6 +18066,7 @@ func (v *VirtualMachineScaleSetVM) UnmarshalJSON(data []byte) error { func (v VirtualMachineScaleSetVMExtension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) populate(objectMap, "type", v.Type) @@ -17897,6 +18085,9 @@ func (v *VirtualMachineScaleSetVMExtension) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -18225,6 +18416,7 @@ func (v VirtualMachineScaleSetVMProfile) MarshalJSON() ([]byte, error) { populate(objectMap, "osProfile", v.OSProfile) populate(objectMap, "priority", v.Priority) populate(objectMap, "scheduledEventsProfile", v.ScheduledEventsProfile) + populate(objectMap, "securityPostureReference", v.SecurityPostureReference) populate(objectMap, "securityProfile", v.SecurityProfile) populate(objectMap, "serviceArtifactReference", v.ServiceArtifactReference) populate(objectMap, "storageProfile", v.StorageProfile) @@ -18277,6 +18469,9 @@ func (v *VirtualMachineScaleSetVMProfile) UnmarshalJSON(data []byte) error { case "scheduledEventsProfile": err = unpopulate(val, "ScheduledEventsProfile", &v.ScheduledEventsProfile) delete(rawMsg, key) + case "securityPostureReference": + err = unpopulate(val, "SecurityPostureReference", &v.SecurityPostureReference) + delete(rawMsg, key) case "securityProfile": err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) delete(rawMsg, key) @@ -18820,6 +19015,7 @@ func (w *WindowsParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WindowsVMGuestPatchAutomaticByPlatformSettings. func (w WindowsVMGuestPatchAutomaticByPlatformSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "bypassPlatformSafetyChecksOnUserSchedule", w.BypassPlatformSafetyChecksOnUserSchedule) populate(objectMap, "rebootSetting", w.RebootSetting) return json.Marshal(objectMap) } @@ -18833,6 +19029,9 @@ func (w *WindowsVMGuestPatchAutomaticByPlatformSettings) UnmarshalJSON(data []by for key, val := range rawMsg { var err error switch key { + case "bypassPlatformSafetyChecksOnUserSchedule": + err = unpopulate(val, "BypassPlatformSafetyChecksOnUserSchedule", &w.BypassPlatformSafetyChecksOnUserSchedule) + delete(rawMsg, key) case "rebootSetting": err = unpopulate(val, "RebootSetting", &w.RebootSetting) delete(rawMsg, key) diff --git a/sdk/resourcemanager/compute/armcompute/operations_client.go b/sdk/resourcemanager/compute/armcompute/operations_client.go index 04db3e70ec86..92dde75d6d7d 100644 --- a/sdk/resourcemanager/compute/armcompute/operations_client.go +++ b/sdk/resourcemanager/compute/armcompute/operations_client.go @@ -40,7 +40,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Gets a list of compute operations. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-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 4318839f1db9..000000000000 --- a/sdk/resourcemanager/compute/armcompute/operations_client_example_test.go +++ /dev/null @@ -1,83 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/computeRPCommonExamples/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armcompute.OperationListResult{ - // Value: []*armcompute.OperationValue{ - // { - // Name: to.Ptr("aaaaaaaaaaaa"), - // Display: &armcompute.OperationValueDisplay{ - // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Operation: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Provider: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Resource: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Origin: to.Ptr("aaaaa"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/computeRPCommonExamples/Operations_List_MinimumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armcompute.OperationListResult{ - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go b/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go index 62c35492c182..7d12d0f07f2d 100644 --- a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -89,7 +89,7 @@ func (client *ProximityPlacementGroupsClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -107,7 +107,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -147,7 +147,7 @@ func (client *ProximityPlacementGroupsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -156,7 +156,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -199,7 +199,7 @@ func (client *ProximityPlacementGroupsClient) getCreateRequest(ctx context.Conte if options != nil && options.IncludeColocationStatus != nil { reqQP.Set("includeColocationStatus", *options.IncludeColocationStatus) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -216,7 +216,7 @@ func (client *ProximityPlacementGroupsClient) getHandleResponse(resp *http.Respo // NewListByResourceGroupPager - Lists all proximity placement groups in a resource group. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - options - ProximityPlacementGroupsClientListByResourceGroupOptions contains the optional parameters for the ProximityPlacementGroupsClient.NewListByResourceGroupPager // method. @@ -264,7 +264,7 @@ func (client *ProximityPlacementGroupsClient) listByResourceGroupCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +281,7 @@ func (client *ProximityPlacementGroupsClient) listByResourceGroupHandleResponse( // NewListBySubscriptionPager - Lists all proximity placement groups in a subscription. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - options - ProximityPlacementGroupsClientListBySubscriptionOptions contains the optional parameters for the ProximityPlacementGroupsClient.NewListBySubscriptionPager // method. func (client *ProximityPlacementGroupsClient) NewListBySubscriptionPager(options *ProximityPlacementGroupsClientListBySubscriptionOptions) *runtime.Pager[ProximityPlacementGroupsClientListBySubscriptionResponse] { @@ -324,7 +324,7 @@ func (client *ProximityPlacementGroupsClient) listBySubscriptionCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,7 +342,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -383,7 +383,7 @@ func (client *ProximityPlacementGroupsClient) updateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go b/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go deleted file mode 100644 index 135ca307e14b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/proximityplacementgroups_client_example_test.go +++ /dev/null @@ -1,277 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.json -func ExampleProximityPlacementGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProximityPlacementGroupsClient().CreateOrUpdate(ctx, "myResourceGroup", "myProximityPlacementGroup", armcompute.ProximityPlacementGroup{ - Location: to.Ptr("westus"), - Properties: &armcompute.ProximityPlacementGroupProperties{ - Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - VMSizes: []*string{ - to.Ptr("Basic_A0"), - to.Ptr("Basic_A2")}, - }, - ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProximityPlacementGroup = armcompute.ProximityPlacementGroup{ - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - // VMSizes: []*string{ - // to.Ptr("Basic_A0"), - // to.Ptr("Basic_A2")}, - // }, - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.json -func ExampleProximityPlacementGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProximityPlacementGroupsClient().Update(ctx, "myResourceGroup", "myProximityPlacementGroup", armcompute.ProximityPlacementGroupUpdate{ - Tags: map[string]*string{ - "additionalProp1": to.Ptr("string"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProximityPlacementGroup = armcompute.ProximityPlacementGroup{ - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.json -func ExampleProximityPlacementGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProximityPlacementGroupsClient().Delete(ctx, "myResourceGroup", "myProximityPlacementGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.json -func ExampleProximityPlacementGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProximityPlacementGroupsClient().Get(ctx, "myResourceGroup", "myProximityPlacementGroup", &armcompute.ProximityPlacementGroupsClientGetOptions{IncludeColocationStatus: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProximityPlacementGroup = armcompute.ProximityPlacementGroup{ - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // AvailabilitySets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - // VMSizes: []*string{ - // to.Ptr("Basic_A0"), - // to.Ptr("Basic_A2")}, - // }, - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // VirtualMachineScaleSets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // VirtualMachines: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.json -func ExampleProximityPlacementGroupsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProximityPlacementGroupsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProximityPlacementGroupListResult = armcompute.ProximityPlacementGroupListResult{ - // Value: []*armcompute.ProximityPlacementGroup{ - // { - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // AvailabilitySets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - // VMSizes: []*string{ - // to.Ptr("Basic_A0"), - // to.Ptr("Basic_A2")}, - // }, - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // VirtualMachineScaleSets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // VirtualMachines: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.json -func ExampleProximityPlacementGroupsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProximityPlacementGroupsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProximityPlacementGroupListResult = armcompute.ProximityPlacementGroupListResult{ - // Value: []*armcompute.ProximityPlacementGroup{ - // { - // Name: to.Ptr("myProximityPlacementGroup"), - // Type: to.Ptr("Microsoft.Compute/proximityPlacementGroups"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myProximityPlacementGroup"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.ProximityPlacementGroupProperties{ - // AvailabilitySets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // Intent: &armcompute.ProximityPlacementGroupPropertiesIntent{ - // VMSizes: []*string{ - // to.Ptr("Basic_A0"), - // to.Ptr("Basic_A2")}, - // }, - // ProximityPlacementGroupType: to.Ptr(armcompute.ProximityPlacementGroupTypeStandard), - // VirtualMachineScaleSets: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // VirtualMachines: []*armcompute.SubResourceWithColocationStatus{ - // { - // ID: to.Ptr("string"), - // }}, - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go b/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go deleted file mode 100644 index 266ed7384b90..000000000000 --- a/sdk/resourcemanager/compute/armcompute/resourceskus_client_example_test.go +++ /dev/null @@ -1,612 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkus.json -func ExampleResourceSKUsClient_NewListPager_listsAllAvailableResourceSkUs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceSKUsClient().NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil, - IncludeExtendedLocations: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceSKUsResult = armcompute.ResourceSKUsResult{ - // Value: []*armcompute.ResourceSKU{ - // { - // Name: to.Ptr("Standard_A0"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // ZoneDetails: []*armcompute.ResourceSKUZoneDetails{ - // { - // Name: []*string{ - // to.Ptr("2")}, - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("UltraSSDAvailable"), - // Value: to.Ptr("True"), - // }}, - // }}, - // Zones: []*string{ - // to.Ptr("2"), - // to.Ptr("1")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_A1"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("71680"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("1.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A1"), - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkusForARegion.json -func ExampleResourceSKUsClient_NewListPager_listsAllAvailableResourceSkUsForTheSpecifiedRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceSKUsClient().NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: to.Ptr("location eq 'westus'"), - IncludeExtendedLocations: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceSKUsResult = armcompute.ResourceSKUsResult{ - // Value: []*armcompute.ResourceSKU{ - // { - // Name: to.Ptr("Standard_A0"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // ZoneDetails: []*armcompute.ResourceSKUZoneDetails{ - // { - // Name: []*string{ - // to.Ptr("2")}, - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("UltraSSDAvailable"), - // Value: to.Ptr("True"), - // }}, - // }}, - // Zones: []*string{ - // to.Ptr("2"), - // to.Ptr("1")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_A1"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("71680"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("1.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A1"), - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples/skus/ListAvailableResourceSkusWithExtendedLocations.json -func ExampleResourceSKUsClient_NewListPager_listsAllAvailableResourceSkUsWithExtendedLocationInformation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceSKUsClient().NewListPager(&armcompute.ResourceSKUsClientListOptions{Filter: nil, - IncludeExtendedLocations: to.Ptr("true"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceSKUsResult = armcompute.ResourceSKUsResult{ - // Value: []*armcompute.ResourceSKU{ - // { - // Name: to.Ptr("Standard_A0"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // ZoneDetails: []*armcompute.ResourceSKUZoneDetails{ - // { - // Name: []*string{ - // to.Ptr("2")}, - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("UltraSSDAvailable"), - // Value: to.Ptr("True"), - // }}, - // }}, - // Zones: []*string{ - // to.Ptr("2"), - // to.Ptr("1")}, - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_A1"), - // Capabilities: []*armcompute.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("71680"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("1.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardA0_A7Family"), - // LocationInfo: []*armcompute.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("westus"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Type: to.Ptr(armcompute.ExtendedLocationTypeEdgeZone), - // ExtendedLocations: []*string{ - // to.Ptr("Las Vegas"), - // to.Ptr("Seattle"), - // to.Ptr("Portland")}, - // Location: to.Ptr("westus"), - // }}, - // Locations: []*string{ - // to.Ptr("westus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Size: to.Ptr("A1"), - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/response_types.go b/sdk/resourcemanager/compute/armcompute/response_types.go index efcb524334d3..2a77733c9f28 100644 --- a/sdk/resourcemanager/compute/armcompute/response_types.go +++ b/sdk/resourcemanager/compute/armcompute/response_types.go @@ -322,6 +322,11 @@ type DedicatedHostsClientGetResponse struct { DedicatedHost } +// DedicatedHostsClientListAvailableSizesResponse contains the response from method DedicatedHostsClient.NewListAvailableSizesPager. +type DedicatedHostsClientListAvailableSizesResponse struct { + DedicatedHostSizeListResult +} + // DedicatedHostsClientListByHostGroupResponse contains the response from method DedicatedHostsClient.NewListByHostGroupPager. type DedicatedHostsClientListByHostGroupResponse struct { DedicatedHostListResult @@ -1248,6 +1253,11 @@ type VirtualMachineScaleSetsClientPowerOffResponse struct { // placeholder for future response values } +// VirtualMachineScaleSetsClientReapplyResponse contains the response from method VirtualMachineScaleSetsClient.BeginReapply. +type VirtualMachineScaleSetsClientReapplyResponse struct { + // placeholder for future response values +} + // VirtualMachineScaleSetsClientRedeployResponse contains the response from method VirtualMachineScaleSetsClient.BeginRedeploy. type VirtualMachineScaleSetsClientRedeployResponse 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 9d2fa6d4ac44..85ac1df0b150 100644 --- a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client.go +++ b/sdk/resourcemanager/compute/armcompute/restorepointcollections_client.go @@ -49,7 +49,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -90,7 +90,7 @@ func (client *RestorePointCollectionsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -109,7 +109,7 @@ func (client *RestorePointCollectionsClient) createOrUpdateHandleResponse(resp * // points. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 @@ -130,7 +130,7 @@ func (client *RestorePointCollectionsClient) BeginDelete(ctx context.Context, re // points. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 func (client *RestorePointCollectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, restorePointCollectionName, options) if err != nil { @@ -166,7 +166,7 @@ func (client *RestorePointCollectionsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,7 +175,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -218,7 +218,7 @@ func (client *RestorePointCollectionsClient) getCreateRequest(ctx context.Contex if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,7 +235,7 @@ func (client *RestorePointCollectionsClient) getHandleResponse(resp *http.Respon // NewListPager - Gets the list of restore point collections in a resource group. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - options - RestorePointCollectionsClientListOptions contains the optional parameters for the RestorePointCollectionsClient.NewListPager // method. @@ -283,7 +283,7 @@ func (client *RestorePointCollectionsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,7 +302,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 2022-11-01 +// Generated from API version 2023-03-01 // - options - RestorePointCollectionsClientListAllOptions contains the optional parameters for the RestorePointCollectionsClient.NewListAllPager // method. func (client *RestorePointCollectionsClient) NewListAllPager(options *RestorePointCollectionsClientListAllOptions) *runtime.Pager[RestorePointCollectionsClientListAllResponse] { @@ -345,7 +345,7 @@ func (client *RestorePointCollectionsClient) listAllCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -363,7 +363,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -404,7 +404,7 @@ func (client *RestorePointCollectionsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go b/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go deleted file mode 100644 index 73a97aacd44c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/restorepointcollections_client_example_test.go +++ /dev/null @@ -1,634 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.json -func ExampleRestorePointCollectionsClient_CreateOrUpdate_createOrUpdateARestorePointCollectionForCrossRegionCopy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().CreateOrUpdate(ctx, "myResourceGroup", "myRpc", armcompute.RestorePointCollection{ - Location: to.Ptr("norwayeast"), - Tags: map[string]*string{ - "myTag1": to.Ptr("tagValue1"), - }, - Properties: &armcompute.RestorePointCollectionProperties{ - Source: &armcompute.RestorePointCollectionSourceProperties{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("norwayeast"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("638f052b-a7c2-450c-89e7-6a3b8f1d6a7c"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePointCollection_CreateOrUpdate.json -func ExampleRestorePointCollectionsClient_CreateOrUpdate_createOrUpdateARestorePointCollection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().CreateOrUpdate(ctx, "myResourceGroup", "myRpc", armcompute.RestorePointCollection{ - Location: to.Ptr("norwayeast"), - Tags: map[string]*string{ - "myTag1": to.Ptr("tagValue1"), - }, - Properties: &armcompute.RestorePointCollectionProperties{ - Source: &armcompute.RestorePointCollectionSourceProperties{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("norwayeast"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("638f052b-a7c2-450c-89e7-6a3b8f1d6a7c"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePointCollections_Update_MaximumSet_Gen.json -func ExampleRestorePointCollectionsClient_Update_restorePointCollectionsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.RestorePointCollectionUpdate{ - Tags: map[string]*string{ - "key8536": to.Ptr("aaaaaaaaaaaaaaaaaaa"), - }, - Properties: &armcompute.RestorePointCollectionProperties{ - Source: &armcompute.RestorePointCollectionSourceProperties{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("norwayeast"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("638f052b-a7c2-450c-89e7-6a3b8f1d6a7c"), - // RestorePoints: []*armcompute.RestorePoint{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaa"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesCrashConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](9), - // VCPUsPerCore: to.Ptr[int32](12), - // }, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("aaa"), - // KeyData: to.Ptr("aaaaaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // { - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VaultCertificates: []*armcompute.VaultCertificate{ - // { - // CertificateStore: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // CertificateURL: to.Ptr("aaaaaaa"), - // }}, - // }}, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // DiskSizeGB: to.Ptr[int32](24), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // DiskSizeGB: to.Ptr[int32](3), - // EncryptionSettings: &armcompute.DiskEncryptionSettings{ - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.593Z"); return t}()), - // }, - // }}, - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePointCollections_Update_MinimumSet_Gen.json -func ExampleRestorePointCollectionsClient_Update_restorePointCollectionsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().Update(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", armcompute.RestorePointCollectionUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Location: to.Ptr("norwayeast"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePointCollections_Delete_MaximumSet_Gen.json -func ExampleRestorePointCollectionsClient_BeginDelete_restorePointCollectionsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointCollectionsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePointCollections_Delete_MinimumSet_Gen.json -func ExampleRestorePointCollectionsClient_BeginDelete_restorePointCollectionsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointCollectionsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePointCollection_Get.json -func ExampleRestorePointCollectionsClient_Get_getARestorePointCollectionButNotTheRestorePointsContainedInTheRestorePointCollection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().Get(ctx, "myResourceGroup", "myRpc", &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("myRpc"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/myRpc"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.json -func ExampleRestorePointCollectionsClient_Get_getARestorePointCollectionIncludingTheRestorePointsContainedInTheRestorePointCollection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointCollectionsClient().Get(ctx, "myResourceGroup", "rpcName", &armcompute.RestorePointCollectionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePointCollection = armcompute.RestorePointCollection{ - // Name: to.Ptr("rpcName"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // RestorePoints: []*armcompute.RestorePoint{ - // { - // Name: to.Ptr("restorePointName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesApplicationConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vm8768_disk2_fe6ffde4f69b491ca33fb984d5bcd89f"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // }, - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-27T20:35:05.8401519+00:00"); return t}()), - // }, - // }}, - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("eastus"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePointCollection_ListByResourceGroup.json -func ExampleRestorePointCollectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorePointCollectionsClient().NewListPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorePointCollectionListResult = armcompute.RestorePointCollectionListResult{ - // Value: []*armcompute.RestorePointCollection{ - // { - // Name: to.Ptr("restorePointCollection1"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection1"), - // Location: to.Ptr("westus"), - // }, - // }, - // }, - // { - // Name: to.Ptr("restorePointCollection2"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("2875c590-e337-4102-9668-4f5b7e3f98a4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/restorePointCollection2"), - // Location: to.Ptr("westus"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePointCollection_ListBySubscription.json -func ExampleRestorePointCollectionsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorePointCollectionsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorePointCollectionListResult = armcompute.RestorePointCollectionListResult{ - // Value: []*armcompute.RestorePointCollection{ - // { - // Name: to.Ptr("restorePointCollection1"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resourceGroup1/providers/Microsoft.Compute/restorePointCollections/restorePointCollection1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("59f04a5d-f783-4200-a1bd-d3f464e8c4b4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/VM_Test"), - // Location: to.Ptr("westus"), - // }, - // }, - // }, - // { - // Name: to.Ptr("restorePointCollection2"), - // Type: to.Ptr("Microsoft.Compute/restorePointCollections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resourceGroup2/providers/Microsoft.Compute/restorePointCollections/restorePointCollection2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.RestorePointCollectionProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // RestorePointCollectionID: to.Ptr("2875c590-e337-4102-9668-4f5b7e3f98a4"), - // Source: &armcompute.RestorePointCollectionSourceProperties{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/VM_Prod"), - // Location: to.Ptr("westus"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/restorepoints_client.go b/sdk/resourcemanager/compute/armcompute/restorepoints_client.go index 724a7ac574c2..dc3b1da6e128 100644 --- a/sdk/resourcemanager/compute/armcompute/restorepoints_client.go +++ b/sdk/resourcemanager/compute/armcompute/restorepoints_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *RestorePointsClient) create(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, parameters, options) if err != nil { @@ -110,7 +110,7 @@ func (client *RestorePointsClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -119,7 +119,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - restorePointCollectionName - The name of the Restore Point Collection. // - restorePointName - The name of the restore point. @@ -140,7 +140,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *RestorePointsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, options) if err != nil { @@ -180,7 +180,7 @@ func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,7 +189,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - restorePointCollectionName - The name of the restore point collection. // - restorePointName - The name of the restore point. @@ -236,7 +236,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-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 51ee39d9e4fc..000000000000 --- a/sdk/resourcemanager/compute/armcompute/restorepoints_client_example_test.go +++ /dev/null @@ -1,315 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePoint_Copy_BetweenRegions.json -func ExampleRestorePointsClient_BeginCreate_copyARestorePointToADifferentRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().BeginCreate(ctx, "myResourceGroup", "rpcName", "rpName", armcompute.RestorePoint{ - Properties: &armcompute.RestorePointProperties{ - SourceRestorePoint: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName/restorePoints/sourceRpName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePoint_Create.json -func ExampleRestorePointsClient_BeginCreate_createARestorePoint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().BeginCreate(ctx, "myResourceGroup", "rpcName", "rpName", armcompute.RestorePoint{ - Properties: &armcompute.RestorePointProperties{ - ExcludeDisks: []*armcompute.APIEntityReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePoints_Delete_MaximumSet_Gen.json -func ExampleRestorePointsClient_BeginDelete_restorePointsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", "a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePoints_Delete_MinimumSet_Gen.json -func ExampleRestorePointsClient_BeginDelete_restorePointsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePoint_Get.json -func ExampleRestorePointsClient_Get_getARestorePoint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointsClient().Get(ctx, "myResourceGroup", "rpcName", "rpName", &armcompute.RestorePointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePoint = armcompute.RestorePoint{ - // Name: to.Ptr("rpName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesApplicationConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vm8768_disk2_fe6ffde4f69b491ca33fb984d5bcd89f"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // }, - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/restorePointCollections/mynewrpc/restorePoints/restorepointtwo/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-27T20:35:05.8401519+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/restorePointExamples/RestorePoint_Get_WithInstanceView.json -func ExampleRestorePointsClient_Get_getRestorePointWithInstanceView() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointsClient().Get(ctx, "myResourceGroup", "rpcName", "rpName", &armcompute.RestorePointsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePoint = armcompute.RestorePoint{ - // Name: to.Ptr("rpName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName"), - // Properties: &armcompute.RestorePointProperties{ - // ConsistencyMode: to.Ptr(armcompute.ConsistencyModeTypesApplicationConsistent), - // ExcludeDisks: []*armcompute.APIEntityReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vm8768_disk2_fe6ffde4f69b491ca33fb984d5bcd89f"), - // }}, - // InstanceView: &armcompute.RestorePointInstanceView{ - // DiskRestorePoints: []*armcompute.DiskRestorePointInstanceView{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // ReplicationStatus: &armcompute.DiskRestorePointReplicationStatus{ - // CompletionPercent: to.Ptr[int32](100), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("ReplicationState/succeeded"), - // DisplayStatus: to.Ptr("Succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/restorePointCollections/mynewrpc/restorePoints/restorepointtwo/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // ReplicationStatus: &armcompute.DiskRestorePointReplicationStatus{ - // CompletionPercent: to.Ptr[int32](100), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("ReplicationState/succeeded"), - // DisplayStatus: to.Ptr("Succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // }, - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ReplicationState/succeeded"), - // DisplayStatus: to.Ptr("Succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SourceMetadata: &armcompute.RestorePointSourceMetadata{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), - // }, - // Location: to.Ptr("westus"), - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("computerName"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.RestorePointSourceVMStorageProfile{ - // DataDisks: []*armcompute.RestorePointSourceVMDataDisk{ - // { - // Name: to.Ptr("testingexcludedisk_DataDisk_1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/restorePointCollections/mynewrpc/restorePoints/restorepointtwo/diskRestorePoints/testingexcludedisk_DataDisk_1_68785190-1acb-4d5e-a8ae-705b45f3dca5"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/userdata/providers/Microsoft.Compute/disks/testingexcludedisk_DataDisk_1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // OSDisk: &armcompute.RestorePointSourceVMOSDisk{ - // Name: to.Ptr("testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // DiskRestorePoint: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/rpName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypeWindows), - // }, - // }, - // VMID: to.Ptr("76d6541e-80bd-4dc1-932b-3cae4cfb80e7"), - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-27T20:35:05.8401519+00:00"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go deleted file mode 100644 index b90b7f25b340..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleries_client_example_test.go +++ /dev/null @@ -1,80 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGallery_List.json -func ExampleSharedGalleriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedGalleriesClient().NewListPager("myLocation", &armcompute.SharedGalleriesClientListOptions{SharedTo: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedGalleryList = armcompute.SharedGalleryList{ - // Value: []*armcompute.SharedGallery{ - // { - // Name: to.Ptr("galleryUniqueName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGallery_Get.json -func ExampleSharedGalleriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedGalleriesClient().Get(ctx, "myLocation", "galleryUniqueName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedGallery = armcompute.SharedGallery{ - // Name: to.Ptr("myGalleryName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName"), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go deleted file mode 100644 index 55db7dba42b8..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimages_client_example_test.go +++ /dev/null @@ -1,102 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImages_List.json -func ExampleSharedGalleryImagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedGalleryImagesClient().NewListPager("myLocation", "galleryUniqueName", &armcompute.SharedGalleryImagesClientListOptions{SharedTo: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedGalleryImageList = armcompute.SharedGalleryImageList{ - // Value: []*armcompute.SharedGalleryImage{ - // { - // Name: to.Ptr("myGalleryImageName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName"), - // }, - // Properties: &armcompute.SharedGalleryImageProperties{ - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Identifier: &armcompute.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImage_Get.json -func ExampleSharedGalleryImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedGalleryImagesClient().Get(ctx, "myLocation", "galleryUniqueName", "myGalleryImageName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedGalleryImage = armcompute.SharedGalleryImage{ - // Name: to.Ptr("myGalleryImageName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName"), - // }, - // Properties: &armcompute.SharedGalleryImageProperties{ - // Eula: to.Ptr("https://www.microsoft.com/en-us/"), - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Identifier: &armcompute.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSState: to.Ptr(armcompute.OperatingSystemStateTypesGeneralized), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // PrivacyStatementURI: to.Ptr("https://www.microsoft.com/en-us/"), - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go deleted file mode 100644 index c6f88e70b4e0..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sharedgalleryimageversions_client_example_test.go +++ /dev/null @@ -1,102 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersions_List.json -func ExampleSharedGalleryImageVersionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedGalleryImageVersionsClient().NewListPager("myLocation", "galleryUniqueName", "myGalleryImageName", &armcompute.SharedGalleryImageVersionsClientListOptions{SharedTo: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedGalleryImageVersionList = armcompute.SharedGalleryImageVersionList{ - // Value: []*armcompute.SharedGalleryImageVersion{ - // { - // Name: to.Ptr("myGalleryImageVersionName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Properties: &armcompute.SharedGalleryImageVersionProperties{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersion_Get.json -func ExampleSharedGalleryImageVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedGalleryImageVersionsClient().Get(ctx, "myLocation", "galleryUniqueName", "myGalleryImageName", "myGalleryImageVersionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedGalleryImageVersion = armcompute.SharedGalleryImageVersion{ - // Name: to.Ptr("myGalleryImageVersionName"), - // Location: to.Ptr("myLocation"), - // Identifier: &armcompute.SharedGalleryIdentifier{ - // UniqueID: to.Ptr("/SharedGalleries/galleryUniqueName/Images/myGalleryImageName/Versions/myGalleryImageVersionName"), - // }, - // Properties: &armcompute.SharedGalleryImageVersionProperties{ - // EndOfLifeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T09:12:28Z"); return t}()), - // ExcludeFromLatest: to.Ptr(false), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-20T09:12:28Z"); return t}()), - // StorageProfile: &armcompute.SharedGalleryImageVersionStorageProfile{ - // OSDiskImage: &armcompute.SharedGalleryOSDiskImage{ - // DiskSizeGB: to.Ptr[int32](29), - // HostCaching: to.Ptr(armcompute.SharedGalleryHostCachingNone), - // }, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go b/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go deleted file mode 100644 index cec355140bfc..000000000000 --- a/sdk/resourcemanager/compute/armcompute/snapshots_client_example_test.go +++ /dev/null @@ -1,697 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot1", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - StorageAccountID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot1"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - // SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // StorageAccountID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot1", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot1"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - // SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot2", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyStart), - SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot2"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyStart), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json -func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot2", armcompute.Snapshot{ - Location: to.Ptr("West US"), - Properties: &armcompute.SnapshotProperties{ - CreationData: &armcompute.CreationData{ - CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot2"), - // Location: to.Ptr("West US"), - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.json -func ExampleSnapshotsClient_BeginUpdate_updateASnapshotWithAcceleratedNetworking() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginUpdate(ctx, "myResourceGroup", "mySnapshot", armcompute.SnapshotUpdate{ - Properties: &armcompute.SnapshotUpdateProperties{ - DiskSizeGB: to.Ptr[int32](20), - SupportedCapabilities: &armcompute.SupportedCapabilities{ - AcceleratedNetwork: to.Ptr(false), - }, - }, - Tags: map[string]*string{ - "department": to.Ptr("Development"), - "project": to.Ptr("UpdateSnapshots"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("UpdateSnapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // DiskSizeGB: to.Ptr[int32](20), - // ProvisioningState: to.Ptr("Succeeded"), - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Update.json -func ExampleSnapshotsClient_BeginUpdate_updateASnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginUpdate(ctx, "myResourceGroup", "mySnapshot", armcompute.SnapshotUpdate{ - Properties: &armcompute.SnapshotUpdateProperties{ - DiskSizeGB: to.Ptr[int32](20), - }, - Tags: map[string]*string{ - "department": to.Ptr("Development"), - "project": to.Ptr("UpdateSnapshots"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("UpdateSnapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // }, - // DiskSizeGB: to.Ptr[int32](20), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Get.json -func ExampleSnapshotsClient_Get_getInformationAboutASnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSnapshotsClient().Get(ctx, "myResourceGroup", "mySnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("mySnapshot"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // SourceUniqueID: to.Ptr("d633885d-d102-4481-901e-5b2413d1a7be"), - // }, - // DiskSizeGB: to.Ptr[int32](100), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // }}, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("test_sku"), - // Product: to.Ptr("marketplace_vm_test"), - // Publisher: to.Ptr("test_test_pmc2pc1"), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // SupportsHibernation: to.Ptr(true), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079872+00:00"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_GetIncrementalSnapshot.json -func ExampleSnapshotsClient_Get_getInformationAboutAnIncrementalSnapshot() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSnapshotsClient().Get(ctx, "myResourceGroup", "myIncrementalSnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Snapshot = armcompute.Snapshot{ - // Name: to.Ptr("myIncrementalSnapshot"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/myIncrementalSnapshot"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"), - // SourceUniqueID: to.Ptr("d633885d-d102-4481-901e-5b2413d1a7be"), - // }, - // DiskSizeBytes: to.Ptr[int64](10737418240), - // DiskSizeGB: to.Ptr[int32](100), - // DiskState: to.Ptr(armcompute.DiskState("0")), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // }}, - // }, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1), - // Incremental: to.Ptr(true), - // IncrementalSnapshotFamilyID: to.Ptr("d1a341d5-1ea7-4a85-b304-944ad8021639"), - // NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicy("0")), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchasePlan: &armcompute.DiskPurchasePlan{ - // Name: to.Ptr("test_sku"), - // Product: to.Ptr("marketplace_vm_test"), - // Publisher: to.Ptr("test_test_pmc2pc1"), - // }, - // SupportedCapabilities: &armcompute.SupportedCapabilities{ - // AcceleratedNetwork: to.Ptr(true), - // }, - // SupportsHibernation: to.Ptr(true), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.079872+00:00"); return t}()), - // UniqueID: to.Ptr("a395e9c1-fb9e-446e-a9ba-7b2fa0bcd305"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_Delete.json -func ExampleSnapshotsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginDelete(ctx, "myResourceGroup", "mySnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_ListByResourceGroup.json -func ExampleSnapshotsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSnapshotsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SnapshotList = armcompute.SnapshotList{ - // Value: []*armcompute.Snapshot{ - // { - // Name: to.Ptr("mySnapshot"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:41:35.9278721+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_ListBySubscription.json -func ExampleSnapshotsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSnapshotsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SnapshotList = armcompute.SnapshotList{ - // Value: []*armcompute.Snapshot{ - // { - // Name: to.Ptr("mySnapshot1"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy), - // SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:47:30.6630569+00:00"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("mySnapshot2"), - // Type: to.Ptr("Microsoft.Compute/snapshots"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "department": to.Ptr("Development"), - // "project": to.Ptr("Snapshots"), - // }, - // Properties: &armcompute.SnapshotProperties{ - // CreationData: &armcompute.CreationData{ - // CreateOption: to.Ptr(armcompute.DiskCreateOptionImport), - // SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"), - // StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - // }, - // DiskSizeGB: to.Ptr[int32](200), - // Encryption: &armcompute.Encryption{ - // Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey), - // }, - // EncryptionSettingsCollection: &armcompute.EncryptionSettingsCollection{ - // Enabled: to.Ptr(true), - // EncryptionSettings: []*armcompute.EncryptionSettingsElement{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultAndSecretReference{ - // SecretURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/secrets/{secret}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // KeyEncryptionKey: &armcompute.KeyVaultAndKeyReference{ - // KeyURL: to.Ptr("https://myvmvault.vault-int.azure-int.net/keys/{key}"), - // SourceVault: &armcompute.SourceVault{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault"), - // }, - // }, - // }}, - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr("Succeeded"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-28T04:47:30.3247198+00:00"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_BeginGetAccess.json -func ExampleSnapshotsClient_BeginGrantAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginGrantAccess(ctx, "myResourceGroup", "mySnapshot", armcompute.GrantAccessData{ - Access: to.Ptr(armcompute.AccessLevelRead), - DurationInSeconds: to.Ptr[int32](300), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessURI = armcompute.AccessURI{ - // AccessSAS: to.Ptr("https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-07-02/examples/snapshotExamples/Snapshot_EndGetAccess.json -func ExampleSnapshotsClient_BeginRevokeAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotsClient().BeginRevokeAccess(ctx, "myResourceGroup", "mySnapshot", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go b/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go index 04c6b4350594..5bf5f7690f31 100644 --- a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go +++ b/sdk/resourcemanager/compute/armcompute/sshpublickeys_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -88,7 +88,7 @@ func (client *SSHPublicKeysClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -106,7 +106,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -145,7 +145,7 @@ func (client *SSHPublicKeysClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -156,7 +156,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -196,7 +196,7 @@ func (client *SSHPublicKeysClient) generateKeyPairCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +214,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -253,7 +253,7 @@ func (client *SSHPublicKeysClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -271,7 +271,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - options - SSHPublicKeysClientListByResourceGroupOptions contains the optional parameters for the SSHPublicKeysClient.NewListByResourceGroupPager // method. @@ -319,7 +319,7 @@ func (client *SSHPublicKeysClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -337,7 +337,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 2022-11-01 +// Generated from API version 2023-03-01 // - options - SSHPublicKeysClientListBySubscriptionOptions contains the optional parameters for the SSHPublicKeysClient.NewListBySubscriptionPager // method. func (client *SSHPublicKeysClient) NewListBySubscriptionPager(options *SSHPublicKeysClientListBySubscriptionOptions) *runtime.Pager[SSHPublicKeysClientListBySubscriptionResponse] { @@ -380,7 +380,7 @@ func (client *SSHPublicKeysClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -398,7 +398,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -438,7 +438,7 @@ func (client *SSHPublicKeysClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go b/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go deleted file mode 100644 index 3b4260322fbd..000000000000 --- a/sdk/resourcemanager/compute/armcompute/sshpublickeys_client_example_test.go +++ /dev/null @@ -1,349 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKeys_ListBySubscription_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeysListBySubscriptionMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // Name: to.Ptr("mySshPublicKeyName"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key6396": to.Ptr("aaaaaaaaaaaaa"), - // "key8839": to.Ptr("aaa"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKeys_ListBySubscription_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeysListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKeys_ListByResourceGroup_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListByResourceGroupPager_sshPublicKeysListByResourceGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // Name: to.Ptr("mySshPublicKeyName"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key6396": to.Ptr("aaaaaaaaaaaaa"), - // "key8839": to.Ptr("aaa"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKeys_ListByResourceGroup_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_NewListByResourceGroupPager_sshPublicKeysListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSSHPublicKeysClient().NewListByResourceGroupPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{ - // Value: []*armcompute.SSHPublicKeyResource{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKey_Create.json -func ExampleSSHPublicKeysClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().Create(ctx, "myResourceGroup", "mySshPublicKeyName", armcompute.SSHPublicKeyResource{ - Location: to.Ptr("westus"), - Properties: &armcompute.SSHPublicKeyResourceProperties{ - PublicKey: to.Ptr("{ssh-rsa public key}"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Name: to.Ptr("mySshPublicKeyName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKeys_Update_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_Update_sshPublicKeysUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().Update(ctx, "rgcompute", "aaaaaaaaaaaa", armcompute.SSHPublicKeyUpdateResource{ - Tags: map[string]*string{ - "key2854": to.Ptr("a"), - }, - Properties: &armcompute.SSHPublicKeyResourceProperties{ - PublicKey: to.Ptr("{ssh-rsa public key}"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Name: to.Ptr("mySshPublicKeyName"), - // Type: to.Ptr("aaaa"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key6396": to.Ptr("aaaaaaaaaaaaa"), - // "key8839": to.Ptr("aaa"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKeys_Update_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_Update_sshPublicKeysUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.SSHPublicKeyUpdateResource{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKeys_Delete_MaximumSet_Gen.json -func ExampleSSHPublicKeysClient_Delete_sshPublicKeysDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSSHPublicKeysClient().Delete(ctx, "rgcompute", "aaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKeys_Delete_MinimumSet_Gen.json -func ExampleSSHPublicKeysClient_Delete_sshPublicKeysDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSSHPublicKeysClient().Delete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKey_Get.json -func ExampleSSHPublicKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().Get(ctx, "myResourceGroup", "mySshPublicKeyName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{ - // Name: to.Ptr("mySshPublicKeyName"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/SshPublicKeys/mySshPublicKeyName"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "{tagName}": to.Ptr("{tagValue}"), - // }, - // Properties: &armcompute.SSHPublicKeyResourceProperties{ - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/sshPublicKeyExamples/SshPublicKeys_GenerateKeyPair.json -func ExampleSSHPublicKeysClient_GenerateKeyPair() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSSHPublicKeysClient().GenerateKeyPair(ctx, "myResourceGroup", "mySshPublicKeyName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SSHPublicKeyGenerateKeyPairResult = armcompute.SSHPublicKeyGenerateKeyPairResult{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/SshPublicKeys/mySshPublicKeyName"), - // PrivateKey: to.Ptr("{ssh private key}"), - // PublicKey: to.Ptr("{ssh-rsa public key}"), - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/usage_client.go b/sdk/resourcemanager/compute/armcompute/usage_client.go index c27c4d18d8c5..2a9ea794d3bd 100644 --- a/sdk/resourcemanager/compute/armcompute/usage_client.go +++ b/sdk/resourcemanager/compute/armcompute/usage_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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] { @@ -95,7 +95,7 @@ func (client *UsageClient) listCreateRequest(ctx context.Context, location strin return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-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 5318c8bb4474..000000000000 --- a/sdk/resourcemanager/compute/armcompute/usage_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/computeRPCommonExamples/Usage_List_MaximumSet_Gen.json -func ExampleUsageClient_NewListPager_usageListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageClient().NewListPager("4_.", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListUsagesResult = armcompute.ListUsagesResult{ - // Value: []*armcompute.Usage{ - // { - // Name: &armcompute.UsageName{ - // LocalizedValue: to.Ptr("aaaaaaaaaaaaaa"), - // Value: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // CurrentValue: to.Ptr[int32](17), - // Limit: to.Ptr[int64](19), - // Unit: to.Ptr("Count"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/computeRPCommonExamples/Usage_List_MinimumSet_Gen.json -func ExampleUsageClient_NewListPager_usageListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageClient().NewListPager("_--", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListUsagesResult = armcompute.ListUsagesResult{ - // Value: []*armcompute.Usage{ - // { - // Name: &armcompute.UsageName{ - // }, - // CurrentValue: to.Ptr[int32](17), - // Limit: to.Ptr[int64](19), - // Unit: to.Ptr("Count"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go index 68da1c042f4b..a235a419a45e 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client.go @@ -49,7 +49,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - options - VirtualMachineExtensionImagesClientGetOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.Get // method. @@ -96,7 +96,7 @@ func (client *VirtualMachineExtensionImagesClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +114,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - options - VirtualMachineExtensionImagesClientListTypesOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.ListTypes // method. @@ -153,7 +153,7 @@ func (client *VirtualMachineExtensionImagesClient) listTypesCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,7 +171,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - options - VirtualMachineExtensionImagesClientListVersionsOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.ListVersions // method. @@ -223,7 +223,7 @@ func (client *VirtualMachineExtensionImagesClient) listVersionsCreateRequest(ctx if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-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 dfabe5b0049b..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensionimages_client_example_test.go +++ /dev/null @@ -1,209 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_Get_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_Get_virtualMachineExtensionImagesGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().Get(ctx, "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImage = armcompute.VirtualMachineExtensionImage{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9885": to.Ptr("aaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionImageProperties{ - // ComputeRole: to.Ptr("aaaaaaaaaaaaaaaaa"), - // HandlerSchema: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // OperatingSystem: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // SupportsMultipleExtensions: to.Ptr(true), - // VMScaleSetEnabled: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_Get_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_Get_virtualMachineExtensionImagesGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().Get(ctx, "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", "aaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImage = armcompute.VirtualMachineExtensionImage{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListTypes_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListTypes_virtualMachineExtensionImagesListTypesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().ListTypes(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9885": to.Ptr("aaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionImageProperties{ - // ComputeRole: to.Ptr("aaaaaaaaaaaaaaaaa"), - // HandlerSchema: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // OperatingSystem: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // SupportsMultipleExtensions: to.Ptr(true), - // VMScaleSetEnabled: to.Ptr(true), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListTypes_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListTypes_virtualMachineExtensionImagesListTypesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().ListTypes(ctx, "aaaa", "aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListVersions_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListVersions_virtualMachineExtensionImagesListVersionsMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().ListVersions(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionImagesClientListVersionsOptions{Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - Top: to.Ptr[int32](22), - Orderby: to.Ptr("a"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9885": to.Ptr("aaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionImageProperties{ - // ComputeRole: to.Ptr("aaaaaaaaaaaaaaaaa"), - // HandlerSchema: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // OperatingSystem: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // SupportsMultipleExtensions: to.Ptr(true), - // VMScaleSetEnabled: to.Ptr(true), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImages_ListVersions_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionImagesClient_ListVersions_virtualMachineExtensionImagesListVersionsMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionImagesClient().ListVersions(ctx, "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", &armcompute.VirtualMachineExtensionImagesClientListVersionsOptions{Filter: nil, - Top: nil, - Orderby: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionImageArray = []*armcompute.VirtualMachineExtensionImage{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // }} -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go index 7f68f6a179b4..c14cbf8e5d23 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) if err != nil { @@ -110,7 +110,7 @@ func (client *VirtualMachineExtensionsClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) @@ -119,7 +119,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -140,7 +140,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, options) if err != nil { @@ -180,7 +180,7 @@ func (client *VirtualMachineExtensionsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,7 +189,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -237,7 +237,7 @@ func (client *VirtualMachineExtensionsClient) getCreateRequest(ctx context.Conte if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,7 +255,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -298,7 +298,7 @@ func (client *VirtualMachineExtensionsClient) listCreateRequest(ctx context.Cont if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -316,7 +316,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -338,7 +338,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineExtensionsClient) update(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) if err != nil { @@ -378,7 +378,7 @@ func (client *VirtualMachineExtensionsClient) updateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go deleted file mode 100644 index bdde2f41def5..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineextensions_client_example_test.go +++ /dev/null @@ -1,437 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachineExtensions_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate_virtualMachineExtensionsCreateOrUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().BeginCreateOrUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaa", armcompute.VirtualMachineExtension{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "key9183": to.Ptr("aa"), - }, - Properties: &armcompute.VirtualMachineExtensionProperties{ - Type: to.Ptr("extType"), - AutoUpgradeMinorVersion: to.Ptr(true), - EnableAutomaticUpgrade: to.Ptr(true), - ForceUpdateTag: to.Ptr("a"), - InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - Type: to.Ptr("aaaaaaaaa"), - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - Substatuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - }, - ProtectedSettings: map[string]any{}, - Publisher: to.Ptr("extPublisher"), - Settings: map[string]any{}, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("1.2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key9183": to.Ptr("aa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("a"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachineExtensions_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate_virtualMachineExtensionsCreateOrUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().BeginCreateOrUpdate(ctx, "rgcompute", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineExtension{ - Location: to.Ptr("westus"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachineExtensions_Update.json -func ExampleVirtualMachineExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().BeginUpdate(ctx, "myResourceGroup", "myVM", "myVMExtension", armcompute.VirtualMachineExtensionUpdate{ - Properties: &armcompute.VirtualMachineExtensionUpdateProperties{ - Type: to.Ptr("extType"), - AutoUpgradeMinorVersion: to.Ptr(true), - ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{ - SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"), - }, - }, - Publisher: to.Ptr("extPublisher"), - Settings: map[string]any{ - "UserName": "xyz@microsoft.com", - }, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("1.2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachineExtensions_Delete_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginDelete_virtualMachineExtensionsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachineExtensions_Delete_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_BeginDelete_virtualMachineExtensionsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineExtensionsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachineExtensions_Get_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_Get_virtualMachineExtensionsGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", &armcompute.VirtualMachineExtensionsClientGetOptions{Expand: to.Ptr("aaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key9183": to.Ptr("aa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("a"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachineExtensions_Get_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_Get_virtualMachineExtensionsGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().Get(ctx, "rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtension = armcompute.VirtualMachineExtension{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachineExtensions_List_MaximumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_List_virtualMachineExtensionsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().List(ctx, "rgcompute", "aaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionsListResult = armcompute.VirtualMachineExtensionsListResult{ - // Value: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/myVMExtension"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key9183": to.Ptr("aa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("a"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachineExtensions_List_MinimumSet_Gen.json -func ExampleVirtualMachineExtensionsClient_List_virtualMachineExtensionsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineExtensionsClient().List(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineExtensionsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineExtensionsListResult = armcompute.VirtualMachineExtensionsListResult{ - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go index 0fc0b2e5d4d8..0e6c10f160c6 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client.go @@ -49,7 +49,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - publisherName - A valid image publisher. // - offer - A valid image publisher offer. @@ -104,7 +104,7 @@ func (client *VirtualMachineImagesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -122,7 +122,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - publisherName - A valid image publisher. // - offer - A valid image publisher offer. @@ -181,7 +181,7 @@ func (client *VirtualMachineImagesClient) listCreateRequest(ctx context.Context, if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,7 +199,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -239,7 +239,7 @@ func (client *VirtualMachineImagesClient) listByEdgeZoneCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,7 +257,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - publisherName - A valid image publisher. // - options - VirtualMachineImagesClientListOffersOptions contains the optional parameters for the VirtualMachineImagesClient.ListOffers @@ -297,7 +297,7 @@ func (client *VirtualMachineImagesClient) listOffersCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -315,7 +315,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - options - VirtualMachineImagesClientListPublishersOptions contains the optional parameters for the VirtualMachineImagesClient.ListPublishers // method. @@ -350,7 +350,7 @@ func (client *VirtualMachineImagesClient) listPublishersCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -368,7 +368,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - publisherName - A valid image publisher. // - offer - A valid image publisher offer. @@ -413,7 +413,7 @@ func (client *VirtualMachineImagesClient) listSKUsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-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 8b98e1bd52ad..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimages_client_example_test.go +++ /dev/null @@ -1,403 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImages_Get_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_Get_virtualMachineImagesGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().Get(ctx, "aaaaaa", "aaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaa"), - // Tags: map[string]*string{ - // "key6817": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineImageProperties{ - // AutomaticOSUpgradeProperties: &armcompute.AutomaticOSUpgradeProperties{ - // AutomaticOSUpgradeSupported: to.Ptr(true), - // }, - // DataDiskImages: []*armcompute.DataDiskImage{ - // { - // Lun: to.Ptr[int32](17), - // }}, - // Disallowed: &armcompute.DisallowedConfiguration{ - // VMDiskType: to.Ptr(armcompute.VMDiskTypesNone), - // }, - // Features: []*armcompute.VirtualMachineImageFeature{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Value: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypesV1), - // ImageDeprecationStatus: &armcompute.ImageDeprecationStatus{ - // AlternativeOption: &armcompute.AlternativeOption{ - // Type: to.Ptr(armcompute.AlternativeTypeOffer), - // Value: to.Ptr("aaaaaaa"), - // }, - // ImageState: to.Ptr(armcompute.ImageStateScheduledForDeprecation), - // ScheduledDeprecationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-13T00:00:00+00:00"); return t}()), - // }, - // OSDiskImage: &armcompute.OSDiskImage{ - // OperatingSystem: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // Plan: &armcompute.PurchasePlan{ - // Name: to.Ptr("aaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImages_Get_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_Get_virtualMachineImagesGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().Get(ctx, "aaaaaaaaaaaa", "aaaaaaaaaaa", "aa", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // Name: to.Ptr("aaaaaaaaa"), - // Location: to.Ptr("aaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImages_List_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_List_virtualMachineImagesListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().List(ctx, "aaaaaaaaaaaaaaa", "aaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineImagesClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - Top: to.Ptr[int32](18), - Orderby: to.Ptr("aa"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImages_List_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_List_virtualMachineImagesListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().List(ctx, "aaaaaaa", "aaaaaaaaaaa", "aaaaaaaaaa", "aaaaaa", &armcompute.VirtualMachineImagesClientListOptions{Expand: nil, - Top: nil, - Orderby: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListOffers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListOffers_virtualMachineImagesListOffersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListOffers(ctx, "aaaaaaa", "aaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListOffers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListOffers_virtualMachineImagesListOffersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListOffers(ctx, "aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListPublishers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListPublishers_virtualMachineImagesListPublishersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListPublishers(ctx, "aaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListPublishers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListPublishers_virtualMachineImagesListPublishersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListPublishers(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListSkus_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListSKUs_virtualMachineImagesListSkusMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListSKUs(ctx, "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListSkus_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListSKUs_virtualMachineImagesListSkusMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListSKUs(ctx, "aaaa", "aaaaaaaaaaaaa", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListByEdgeZone_virtualMachineImagesEdgeZoneListByEdgeZoneMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListByEdgeZone(ctx, "WestUS", "microsoftlosangeles1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMImagesInEdgeZoneListResult = armcompute.VMImagesInEdgeZoneListResult{ - // Value: []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("/Subscriptions/5ece5940-d962-4dad-a98f-ca9ac0f021a5/Providers/Microsoft.Compute/Locations/westus/Publishers/CANONICAL/ArtifactTypes/VMImage/Offers/UBUNTUSERVER/Skus/18_04-LTS-GEN2/Versions/18.04.202107200"), - // Name: to.Ptr("18.04.202107200"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("microsoftlosangeles1"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("WestUS"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.json -func ExampleVirtualMachineImagesClient_ListByEdgeZone_virtualMachineImagesEdgeZoneListByEdgeZoneMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesClient().ListByEdgeZone(ctx, "WestUS", "microsoftlosangeles1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VMImagesInEdgeZoneListResult = armcompute.VMImagesInEdgeZoneListResult{ - // Value: []*armcompute.VirtualMachineImageResource{ - // }, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go index 1dc0f71c505e..d3db9bd044cc 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client.go @@ -49,7 +49,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - edgeZone - The name of the edge zone. // - publisherName - A valid image publisher. @@ -109,7 +109,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -127,7 +127,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - edgeZone - The name of the edge zone. // - publisherName - A valid image publisher. @@ -191,7 +191,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listCreateRequest(ctx context. if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -209,7 +209,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - edgeZone - The name of the edge zone. // - publisherName - A valid image publisher. @@ -254,7 +254,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listOffersCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -272,7 +272,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -312,7 +312,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listPublishersCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The name of a supported Azure region. // - edgeZone - The name of the edge zone. // - publisherName - A valid image publisher. @@ -380,7 +380,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listSKUsCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-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 606c685ad7bd..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineimagesedgezone_client_example_test.go +++ /dev/null @@ -1,339 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_Get_virtualMachineImagesEdgeZoneGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().Get(ctx, "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaa"), - // Tags: map[string]*string{ - // "key6817": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineImageProperties{ - // AutomaticOSUpgradeProperties: &armcompute.AutomaticOSUpgradeProperties{ - // AutomaticOSUpgradeSupported: to.Ptr(true), - // }, - // DataDiskImages: []*armcompute.DataDiskImage{ - // { - // Lun: to.Ptr[int32](17), - // }}, - // Disallowed: &armcompute.DisallowedConfiguration{ - // VMDiskType: to.Ptr(armcompute.VMDiskTypesNone), - // }, - // Features: []*armcompute.VirtualMachineImageFeature{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Value: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypesV1), - // OSDiskImage: &armcompute.OSDiskImage{ - // OperatingSystem: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // Plan: &armcompute.PurchasePlan{ - // Name: to.Ptr("aaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_Get_virtualMachineImagesEdgeZoneGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().Get(ctx, "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImage = armcompute.VirtualMachineImage{ - // Name: to.Ptr("aaaaaaaaa"), - // Location: to.Ptr("aaaaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_List_virtualMachineImagesEdgeZoneListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().List(ctx, "aaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineImagesEdgeZoneClientListOptions{Expand: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - Top: to.Ptr[int32](12), - Orderby: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_List_virtualMachineImagesEdgeZoneListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().List(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaa", "aaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineImagesEdgeZoneClientListOptions{Expand: nil, - Top: nil, - Orderby: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListOffers_virtualMachineImagesEdgeZoneListOffersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListOffers(ctx, "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListOffers_virtualMachineImagesEdgeZoneListOffersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListOffers(ctx, "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListPublishers_virtualMachineImagesEdgeZoneListPublishersMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListPublishers(ctx, "aaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListPublishers_virtualMachineImagesEdgeZoneListPublishersMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListPublishers(ctx, "aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListSKUs_virtualMachineImagesEdgeZoneListSkusMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListSKUs(ctx, "aaaaaaaaaaaa", "aaaaa", "aaaaaaaaaaaa", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // ID: to.Ptr("aaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key7868": to.Ptr("aaaaa"), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.json -func ExampleVirtualMachineImagesEdgeZoneClient_ListSKUs_virtualMachineImagesEdgeZoneListSkusMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineImagesEdgeZoneClient().ListSKUs(ctx, "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaa", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineImageResourceArray = []*armcompute.VirtualMachineImageResource{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }} -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go index afbd2a35daee..1e1c9e9172d2 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) if err != nil { @@ -110,7 +110,7 @@ func (client *VirtualMachineRunCommandsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, runCommand) @@ -119,7 +119,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -140,7 +140,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, runCommandName, options) if err != nil { @@ -180,7 +180,7 @@ func (client *VirtualMachineRunCommandsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -189,7 +189,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The location upon which run commands is queried. // - commandID - The command id. // - options - VirtualMachineRunCommandsClientGetOptions contains the optional parameters for the VirtualMachineRunCommandsClient.Get @@ -229,7 +229,7 @@ func (client *VirtualMachineRunCommandsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -247,7 +247,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -295,7 +295,7 @@ func (client *VirtualMachineRunCommandsClient) getByVirtualMachineCreateRequest( if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -312,7 +312,7 @@ func (client *VirtualMachineRunCommandsClient) getByVirtualMachineHandleResponse // NewListPager - Lists all available run commands for a subscription in a location. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - location - The location upon which run commands is queried. // - options - VirtualMachineRunCommandsClientListOptions contains the optional parameters for the VirtualMachineRunCommandsClient.NewListPager // method. @@ -360,7 +360,7 @@ func (client *VirtualMachineRunCommandsClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -377,7 +377,7 @@ func (client *VirtualMachineRunCommandsClient) listHandleResponse(resp *http.Res // NewListByVirtualMachinePager - The operation to get all run commands of a Virtual Machine. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 @@ -433,7 +433,7 @@ func (client *VirtualMachineRunCommandsClient) listByVirtualMachineCreateRequest if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -451,7 +451,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -473,7 +473,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) if err != nil { @@ -513,7 +513,7 @@ func (client *VirtualMachineRunCommandsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, runCommand) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go deleted file mode 100644 index 66a0ce2ebc3c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachineruncommands_client_example_test.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/RunCommand_List.json -func ExampleVirtualMachineRunCommandsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineRunCommandsClient().NewListPager("SoutheastAsia", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RunCommandListResult = armcompute.RunCommandListResult{ - // Value: []*armcompute.RunCommandDocumentBase{ - // { - // Description: to.Ptr("Configure the machine to enable remote PowerShell."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("EnableRemotePS"), - // Label: to.Ptr("Enable remote PowerShell"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Shows detailed information for the IP address, subnet mask and default gateway for each adapter bound to TCP/IP."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("IPConfig"), - // Label: to.Ptr("List IP configuration"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Custom multiline PowerShell script should be defined in script property. Optional parameters can be set in parameters property."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RunPowerShellScript"), - // Label: to.Ptr("Executes a PowerShell script"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Custom multiline shell script should be defined in script property. Optional parameters can be set in parameters property."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RunShellScript"), - // Label: to.Ptr("Executes a Linux shell script"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // { - // Description: to.Ptr("Get the configuration of all network interfaces."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("ifconfig"), - // Label: to.Ptr("List network configuration"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // { - // Description: to.Ptr("Checks if the local Administrator account is disabled, and if so enables it."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("EnableAdminAccount"), - // Label: to.Ptr("Enable administrator account"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Reset built-in Administrator account password."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("ResetAccountPassword"), - // Label: to.Ptr("Reset built-in Administrator account password"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Checks registry settings and domain policy settings. Suggests policy actions if machine is part of a domain or modifies the settings to default values."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RDPSettings"), - // Label: to.Ptr("Verify RDP Listener Settings"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Sets the default or user specified port number for Remote Desktop connections. Enables firewall rule for inbound access to the port."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("SetRDPPort"), - // Label: to.Ptr("Set Remote Desktop port"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // { - // Description: to.Ptr("Removes the SSL certificate tied to the RDP listener and restores the RDP listerner security to default. Use this script if you see any issues with the certificate."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("ResetRDPCert"), - // Label: to.Ptr("Restore RDP Authentication mode to defaults"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/RunCommand_Get.json -func ExampleVirtualMachineRunCommandsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineRunCommandsClient().Get(ctx, "SoutheastAsia", "RunPowerShellScript", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RunCommandDocument = armcompute.RunCommandDocument{ - // Description: to.Ptr("Custom multiline PowerShell script should be defined in script property. Optional parameters can be set in parameters property."), - // Schema: to.Ptr("http://schema.management.azure.com/schemas/2016-11-17/runcommands.json"), - // ID: to.Ptr("RunPowerShellScript"), - // Label: to.Ptr("Executes a PowerShell script"), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Parameters: []*armcompute.RunCommandParameterDefinition{ - // { - // Name: to.Ptr("arg1"), - // Type: to.Ptr("string"), - // DefaultValue: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("arg2"), - // Type: to.Ptr("string"), - // DefaultValue: to.Ptr("value2"), - // }}, - // Script: []*string{ - // to.Ptr("param("), - // to.Ptr(" [string]$arg1,"), - // to.Ptr(" [string]$arg2"), - // to.Ptr(")"), - // to.Ptr("Write-Host This is a sample script with parameters $arg1 $arg2")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.json -func ExampleVirtualMachineRunCommandsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineRunCommandsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", "myRunCommand", armcompute.VirtualMachineRunCommand{ - Location: to.Ptr("West US"), - Properties: &armcompute.VirtualMachineRunCommandProperties{ - AsyncExecution: to.Ptr(false), - Parameters: []*armcompute.RunCommandInputParameter{ - { - Name: to.Ptr("param1"), - Value: to.Ptr("value1"), - }, - { - Name: to.Ptr("param2"), - Value: to.Ptr("value2"), - }}, - RunAsPassword: to.Ptr(""), - RunAsUser: to.Ptr("user1"), - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - Script: to.Ptr("Write-Host Hello World!"), - }, - TimeoutInSeconds: to.Ptr[int32](3600), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineRunCommand_Update.json -func ExampleVirtualMachineRunCommandsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineRunCommandsClient().BeginUpdate(ctx, "myResourceGroup", "myVM", "myRunCommand", armcompute.VirtualMachineRunCommandUpdate{ - Properties: &armcompute.VirtualMachineRunCommandProperties{ - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - Script: to.Ptr("Write-Host Script Source Updated!"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Script Source Updated!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineRunCommand_Delete.json -func ExampleVirtualMachineRunCommandsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineRunCommandsClient().BeginDelete(ctx, "myResourceGroup", "myVM", "myRunCommand", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineRunCommand_Get.json -func ExampleVirtualMachineRunCommandsClient_GetByVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineRunCommandsClient().GetByVirtualMachine(ctx, "myResourceGroup", "myVM", "myRunCommand", &armcompute.VirtualMachineRunCommandsClientGetByVirtualMachineOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineRunCommand_List.json -func ExampleVirtualMachineRunCommandsClient_NewListByVirtualMachinePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineRunCommandsClient().NewListByVirtualMachinePager("myResourceGroup", "myVM", &armcompute.VirtualMachineRunCommandsClientListByVirtualMachineOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineRunCommandsListResult = armcompute.VirtualMachineRunCommandsListResult{ - // Value: []*armcompute.VirtualMachineRunCommand{ - // { - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](0), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go index bd194cc22dab..ee8f928570c3 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachines_client.go @@ -49,7 +49,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) assessPatches(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*http.Response, error) { req, err := client.assessPatchesCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -107,7 +107,7 @@ func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +117,7 @@ func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Cont // similar VMs. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - parameters - Parameters supplied to the Capture Virtual Machine operation. @@ -141,7 +141,7 @@ func (client *VirtualMachinesClient) BeginCapture(ctx context.Context, resourceG // VMs. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) capture(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesClientBeginCaptureOptions) (*http.Response, error) { req, err := client.captureCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { @@ -177,7 +177,7 @@ func (client *VirtualMachinesClient) captureCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -187,7 +187,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -208,7 +208,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) convertToManagedDisks(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginConvertToManagedDisksOptions) (*http.Response, error) { req, err := client.convertToManagedDisksCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -244,7 +244,7 @@ func (client *VirtualMachinesClient) convertToManagedDisksCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +254,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - parameters - Parameters supplied to the Create Virtual Machine operation. @@ -276,7 +276,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { @@ -312,7 +312,7 @@ func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -322,7 +322,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -343,7 +343,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) deallocate(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeallocateOptions) (*http.Response, error) { req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -382,7 +382,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -391,7 +391,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -411,7 +411,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -450,7 +450,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -463,7 +463,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -503,7 +503,7 @@ func (client *VirtualMachinesClient) generalizeCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -512,7 +512,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -554,7 +554,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -572,7 +572,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -595,7 +595,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) installPatches(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*http.Response, error) { req, err := client.installPatchesCreateRequest(ctx, resourceGroupName, vmName, installPatchesInput, options) if err != nil { @@ -631,7 +631,7 @@ func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, installPatchesInput) @@ -640,7 +640,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -680,7 +680,7 @@ func (client *VirtualMachinesClient) instanceViewCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -698,7 +698,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - options - VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.NewListPager // method. @@ -749,7 +749,10 @@ func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, reso if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2022-11-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -767,7 +770,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 2022-11-01 +// Generated from API version 2023-03-01 // - options - VirtualMachinesClientListAllOptions contains the optional parameters for the VirtualMachinesClient.NewListAllPager // method. func (client *VirtualMachinesClient) NewListAllPager(options *VirtualMachinesClientListAllOptions) *runtime.Pager[VirtualMachinesClientListAllResponse] { @@ -810,13 +813,16 @@ func (client *VirtualMachinesClient) listAllCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") if options != nil && options.StatusOnly != nil { reqQP.Set("statusOnly", *options.StatusOnly) } if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -833,7 +839,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -880,7 +886,7 @@ func (client *VirtualMachinesClient) listAvailableSizesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -897,7 +903,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The location for which virtual machines under the subscription are queried. // - options - VirtualMachinesClientListByLocationOptions contains the optional parameters for the VirtualMachinesClient.NewListByLocationPager // method. @@ -945,7 +951,7 @@ func (client *VirtualMachinesClient) listByLocationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -963,7 +969,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -983,7 +989,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) performMaintenance(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPerformMaintenanceOptions) (*http.Response, error) { req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1019,7 +1025,7 @@ func (client *VirtualMachinesClient) performMaintenanceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1029,7 +1035,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1050,7 +1056,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) powerOff(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPowerOffOptions) (*http.Response, error) { req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1089,7 +1095,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1098,7 +1104,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1118,7 +1124,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) reapply(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReapplyOptions) (*http.Response, error) { req, err := client.reapplyCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1154,7 +1160,7 @@ func (client *VirtualMachinesClient) reapplyCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1163,7 +1169,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1183,7 +1189,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1219,7 +1225,7 @@ func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1232,7 +1238,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1256,7 +1262,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) reimage(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1292,7 +1298,7 @@ func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { @@ -1304,7 +1310,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1324,7 +1330,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) restart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1360,7 +1366,7 @@ func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1369,7 +1375,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1412,7 +1418,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1430,7 +1436,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - parameters - Parameters supplied to the Run command operation. @@ -1453,7 +1459,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) runCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesClientBeginRunCommandOptions) (*http.Response, error) { req, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { @@ -1489,7 +1495,7 @@ func (client *VirtualMachinesClient) runCommandCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -1498,7 +1504,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1538,7 +1544,7 @@ func (client *VirtualMachinesClient) simulateEvictionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1547,7 +1553,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1567,7 +1573,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { @@ -1603,7 +1609,7 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1612,7 +1618,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmName - The name of the virtual machine. // - parameters - Parameters supplied to the Update Virtual Machine operation. @@ -1633,7 +1639,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachinesClient) update(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { @@ -1669,7 +1675,7 @@ func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go deleted file mode 100644 index e5612e63ab35..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachines_client_example_test.go +++ /dev/null @@ -1,9120 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_ListBySubscription_ByLocation.json -func ExampleVirtualMachinesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListByLocationPager("eastus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "RG": to.Ptr("rg"), - // "testTag": to.Ptr("1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](127), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // }, - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "RG": to.Ptr("rg"), - // "testTag": to.Ptr("1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](127), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_Capture_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginCapture_virtualMachinesCaptureMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCapture(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineCaptureParameters{ - DestinationContainerName: to.Ptr("aaaaaaa"), - OverwriteVhds: to.Ptr(true), - VhdPrefix: to.Ptr("aaaaaaaaa"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineCaptureResult = armcompute.VirtualMachineCaptureResult{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Schema: to.Ptr("aaaaa"), - // ContentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Parameters: map[string]any{ - // }, - // Resources: []any{ - // map[string]any{ - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_Capture_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginCapture_virtualMachinesCaptureMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCapture(ctx, "rgcompute", "aaaaaaaaaaaaa", armcompute.VirtualMachineCaptureParameters{ - DestinationContainerName: to.Ptr("aaaaaaa"), - OverwriteVhds: to.Ptr(true), - VhdPrefix: to.Ptr("aaaaaaaaa"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineCaptureResult = armcompute.VirtualMachineCaptureResult{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingAssessmentModeOfImageDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - PatchSettings: &armcompute.LinuxPatchSettings{ - AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("UbuntuServer"), - Publisher: to.Ptr("Canonical"), - SKU: to.Ptr("16.04-LTS"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("UbuntuServer"), - // Publisher: to.Ptr("Canonical"), - // SKU: to.Ptr("16.04-LTS"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndAutomaticByPlatformSettings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - PatchSettings: &armcompute.LinuxPatchSettings{ - AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeAutomaticByPlatform), - AutomaticByPlatformSettings: &armcompute.LinuxVMGuestPatchAutomaticByPlatformSettings{ - RebootSetting: to.Ptr(armcompute.LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), - }, - PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("UbuntuServer"), - Publisher: to.Ptr("Canonical"), - SKU: to.Ptr("16.04-LTS"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeAutomaticByPlatform), - // AutomaticByPlatformSettings: &armcompute.LinuxVMGuestPatchAutomaticByPlatformSettings{ - // RebootSetting: to.Ptr(armcompute.LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), - // }, - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("UbuntuServer"), - // Publisher: to.Ptr("Canonical"), - // SKU: to.Ptr("16.04-LTS"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingPatchModeOfImageDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - PatchSettings: &armcompute.LinuxPatchSettings{ - PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("UbuntuServer"), - Publisher: to.Ptr("Canonical"), - SKU: to.Ptr("16.04-LTS"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // PatchSettings: &armcompute.LinuxPatchSettings{ - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("UbuntuServer"), - // Publisher: to.Ptr("Canonical"), - // SKU: to.Ptr("16.04-LTS"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createALinuxVmWithAPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - PatchSettings: &armcompute.LinuxPatchSettings{ - AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeAutomaticByPlatform), - PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("UbuntuServer"), - Publisher: to.Ptr("Canonical"), - SKU: to.Ptr("16.04-LTS"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeAutomaticByPlatform), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("UbuntuServer"), - // Publisher: to.Ptr("Canonical"), - // SKU: to.Ptr("16.04-LTS"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromACommunityGalleryImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - CommunityGalleryImageID: to.Ptr("/CommunityGalleries/galleryPublicName/Images/communityGalleryImageName/Versions/communityGalleryImageVersionName"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // CommunityGalleryImageID: to.Ptr("/CommunityGalleries/galleryPublicName/Images/communityGalleryImageName/Versions/communityGalleryImageVersionName"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromASharedGalleryImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - SharedGalleryImageID: to.Ptr("/SharedGalleries/sharedGalleryName/Images/sharedGalleryImageName/Versions/sharedGalleryImageVersionName"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // SharedGalleryImageID: to.Ptr("/SharedGalleries/sharedGalleryName/Images/sharedGalleryImageName/Versions/sharedGalleryImageVersionName"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithDiskControllerType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD4V3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DiskControllerType: to.Ptr(armcompute.DiskControllerTypesNVMe), - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("U29tZSBDdXN0b20gRGF0YQ=="), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD4V3), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // DiskControllerType: to.Ptr(armcompute.DiskControllerTypesNVMe), - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithHibernationEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{ - Location: to.Ptr("eastus2euap"), - Properties: &armcompute.VirtualMachineProperties{ - AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - HibernationEnabled: to.Ptr(true), - }, - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("{vm-name}"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2019-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("vmOSdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("{vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/{vm-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("{vm-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("vmOSdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithUefiSettingsOfSecureBootAndVTpm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windowsserver-gen2preview-preview"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("windows10-tvm"), - Version: to.Ptr("18363.592.2001092016"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("windowsserver-gen2preview-preview"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("windows10-tvm"), - // Version: to.Ptr("18363.592.2001092016"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithUserData.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithUserData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("{vm-name}"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("vmOSdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("{vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/{vm-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("{vm-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("vmOSdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_CreateWithVMSizeProperties.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithVmSizeProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD4V3), - VMSizeProperties: &armcompute.VMSizeProperties{ - VCPUsAvailable: to.Ptr[int32](1), - VCPUsPerCore: to.Ptr[int32](1), - }, - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("U29tZSBDdXN0b20gRGF0YQ=="), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD4V3), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](1), - // VCPUsPerCore: to.Ptr[int32](1), - // }, - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithNetworkInterfaceConfiguration() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - { - Name: to.Ptr("{nic-config-name}"), - Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{ - { - Name: to.Ptr("{ip-config-name}"), - Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{ - Primary: to.Ptr(true), - PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{ - Name: to.Ptr("{publicIP-config-name}"), - Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDetach), - PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodStatic), - }, - SKU: &armcompute.PublicIPAddressSKU{ - Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - Tier: to.Ptr(armcompute.PublicIPAddressSKUTierGlobal), - }, - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/toBeCreatedNetworkInterface"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithSecurityTypeConfidentialVmWithCustomerManagedKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypes("Standard_DC2as_v5")), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("2019-datacenter-cvm"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("windows-cvm"), - Version: to.Ptr("17763.2183.2109130127"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - SecurityProfile: &armcompute.VMDiskSecurityProfile{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesDiskWithVMGuestState), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypes("Standard_DC2as_v5")), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("2019-datacenter-cvm"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("windows-cvm"), - // Version: to.Ptr("17763.2183.2109130127"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesDiskWithVMGuestState), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - // }, - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithSecurityTypeConfidentialVmWithPlatformManagedKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypes("Standard_DC2as_v5")), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("2019-datacenter-cvm"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("windows-cvm"), - Version: to.Ptr("17763.2183.2109130127"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - SecurityProfile: &armcompute.VMDiskSecurityProfile{ - SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesDiskWithVMGuestState), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypes("Standard_DC2as_v5")), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("2019-datacenter-cvm"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("windows-cvm"), - // Version: to.Ptr("17763.2183.2109130127"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesDiskWithVMGuestState), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - // }, - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingAssessmentModeOfImageDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByOs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByOS), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByOS), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndAutomaticByPlatformSettings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform), - AutomaticByPlatformSettings: &armcompute.WindowsVMGuestPatchAutomaticByPlatformSettings{ - RebootSetting: to.Ptr(armcompute.WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), - }, - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform), - // AutomaticByPlatformSettings: &armcompute.WindowsVMGuestPatchAutomaticByPlatformSettings{ - // RebootSetting: to.Ptr(armcompute.WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), - // }, - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndEnableHotpatchingSetToTrue() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - EnableHotpatching: to.Ptr(true), - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithAPatchSettingPatchModeOfManual() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAWindowsVmWithPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - WindowsConfiguration: &armcompute.WindowsConfiguration{ - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform), - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeAutomaticByPlatform), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createACustomImageVmFromAnUnmanagedGeneralizedOsImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - Image: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd"), - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{existing-storage-account-name}.blob.core.windows.net/system/Microsoft.Compute/Images/vhds/{existing-generalized-os-image-blob-name}.vhd"), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/vhds/myDisk.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("926cd555-a07c-4ff5-b214-4aa4dd09d79b"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAPlatformImageVmWithUnmanagedOsAndDataDisks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vm-name}", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd"), - }, - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd"), - }, - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("dataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/vhds/myDisk0.vhd"), - // }, - // }, - // { - // Name: to.Ptr("dataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/vhds/myDisk1.vhd"), - // }, - // }}, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/vhds/myDisk.vhd"), - // }, - // }, - // }, - // VMID: to.Ptr("5230a749-2f68-4830-900b-702182d32e63"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromACustomImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromAGeneralizedSharedImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmFromASpecializedSharedImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmInAVirtualMachineScaleSetWithCustomerAssignedPlatformFaultDomain() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - PlatformFaultDomain: to.Ptr[int32](1), - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - VirtualMachineScaleSet: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{existing-flex-vmss-name-with-platformFaultDomainCount-greater-than-1}"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myExistingFlexVmss"), - // }, - // VMID: to.Ptr("7cce54f2-ecd3-4ddd-a8d9-50984faa3918"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmInAnAvailabilitySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - AvailabilitySet: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}"), - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/NSGEXISTINGAS"), - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithApplicationProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - ApplicationProfile: &armcompute.ApplicationProfile{ - GalleryApplications: []*armcompute.VMGalleryApplication{ - { - ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - EnableAutomaticUpgrade: to.Ptr(false), - Order: to.Ptr[int32](1), - PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - Tags: to.Ptr("myTag1"), - TreatFailureAsDeploymentFailure: to.Ptr(false), - }, - { - PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - }}, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("{image_offer}"), - Publisher: to.Ptr("{image_publisher}"), - SKU: to.Ptr("{image_sku}"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // Order: to.Ptr[int32](1), - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - // Tags: to.Ptr("myTag1"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"), - // KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("UbuntuServer"), - // Publisher: to.Ptr("Canonical"), - // SKU: to.Ptr("16.04-LTS"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("e0de9b84-a506-4b95-9623-00a425d05c90"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithDiskEncryptionSetResourceIdInTheOsDiskAndDataDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - ManagedDisk: &armcompute.ManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - { - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - ManagedDisk: &armcompute.ManagedDiskParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}"), - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }}, - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskencryptionset-name}"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("71aa3d5a-d73d-4970-9182-8580433b2865"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithHostEncryptionUsingEncryptionAtHostProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - EncryptionAtHost: to.Ptr(true), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithScheduledEventsProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT15M"), - }, - TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT10M"), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT10M"), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithAMarketplaceImagePlan() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithAnExtensionsTimeBudget() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - ExtensionsTimeBudget: to.Ptr("PT30M"), - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // ExtensionsTimeBudget: to.Ptr("PT30M"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithBootDiagnostics.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithBootDiagnostics() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEmptyDataDisks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("3906fef9-a1e5-4b83-a8a8-540858b41df0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEphemeralOsDiskProvisioningInCacheDiskUsingPlacementProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - }, - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEphemeralOsDiskProvisioningInResourceDiskUsingPlacementProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - Placement: to.Ptr(armcompute.DiffDiskPlacementResourceDisk), - }, - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementResourceDisk), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithEphemeralOsDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - }, - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithManagedBootDiagnostics() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("676420ba-7a24-4bfe-80bd-9c841ee184fa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithPasswordAuthentication() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("b248db33-62ba-4d2d-b791-811e075ee0f5"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithPremiumStorage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("a149cd25-409f-41af-8088-275f5486bc93"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createAVmWithSshAuthentication() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armcompute.SSHConfiguration{ - PublicKeys: []*armcompute.SSHPublicKey{ - { - Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"), - KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"), - }}, - }, - }, - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("{image_offer}"), - Publisher: to.Ptr("{image_publisher}"), - SKU: to.Ptr("{image_sku}"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"), - // KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("UbuntuServer"), - // Publisher: to.Ptr("Canonical"), - // SKU: to.Ptr("16.04-LTS"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesLinux), - // }, - // }, - // VMID: to.Ptr("e0de9b84-a506-4b95-9623-00a425d05c90"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.json -func ExampleVirtualMachinesClient_BeginCreateOrUpdate_createOrUpdateAVmWithCapacityReservation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachine{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineProperties{ - CapacityReservation: &armcompute.CapacityReservationProfile{ - CapacityReservationGroup: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS1V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("5c0d55a7-c407-4ed6-bf7d-ddb810267c85"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.json -func ExampleVirtualMachinesClient_BeginUpdate_updateAVmByDetachingDataDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachineUpdate{ - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - ToBeDetached: to.Ptr(true), - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - ToBeDetached: to.Ptr(false), - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(true), - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(false), - // }}, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("3906fef9-a1e5-4b83-a8a8-540858b41df0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.json -func ExampleVirtualMachinesClient_BeginUpdate_updateAVmByForceDetachingDataDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginUpdate(ctx, "myResourceGroup", "myVM", armcompute.VirtualMachineUpdate{ - Properties: &armcompute.VirtualMachineProperties{ - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - }, - NetworkProfile: &armcompute.NetworkProfile{ - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerName: to.Ptr("myVM"), - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - ToBeDetached: to.Ptr(true), - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - ToBeDetached: to.Ptr(false), - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("myVMosdisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.ManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(true), - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(false), - // }}, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myVMosdisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("3906fef9-a1e5-4b83-a8a8-540858b41df0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Delete_Force.json -func ExampleVirtualMachinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginDelete(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Get.json -func ExampleVirtualMachinesClient_Get_getAVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // Order: to.Ptr[int32](1), - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - // Tags: to.Ptr("myTag1"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/my-AvailabilitySet"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://{myStorageAccount}.blob.core.windows.net"), - // }, - // }, - // ExtensionsTimeBudget: to.Ptr("PT50M"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS3V2), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/my-ppg01"), - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("myDataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk0"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("myDataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("west us"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.json -func ExampleVirtualMachinesClient_Get_getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardD2SV3), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.json -func ExampleVirtualMachinesClient_Get_getAVirtualMachineWithDiskControllerTypeProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: to.Ptr(armcompute.InstanceViewTypesUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // Order: to.Ptr[int32](1), - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - // Tags: to.Ptr("myTag1"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/my-AvailabilitySet"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://{myStorageAccount}.blob.core.windows.net"), - // }, - // }, - // ExtensionsTimeBudget: to.Ptr("PT50M"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS3V2), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](1), - // VCPUsPerCore: to.Ptr[int32](1), - // }, - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("myDataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk0"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("myDataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // DiskControllerType: to.Ptr(armcompute.DiskControllerTypesNVMe), - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("west us"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.json -func ExampleVirtualMachinesClient_Get_getAVirtualMachineWithVmSizeProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "myResourceGroup", "myVM", &armcompute.VirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armcompute.VirtualMachine{ - // Name: to.Ptr("myVM"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // Order: to.Ptr[int32](1), - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - // Tags: to.Ptr("myTag1"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/my-AvailabilitySet"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://{myStorageAccount}.blob.core.windows.net"), - // }, - // }, - // ExtensionsTimeBudget: to.Ptr("PT50M"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardDS3V2), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](1), - // VCPUsPerCore: to.Ptr[int32](1), - // }, - // }, - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{myNIC}"), - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerName: to.Ptr("myVM"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(false), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("myDataDisk0"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](30), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk0"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // { - // Name: to.Ptr("myDataDisk1"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesAttach), - // DiskSizeGB: to.Ptr[int32](100), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDataDisk1"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }}, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("myOsDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myOsDisk"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("west us"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Get_InstanceView.json -func ExampleVirtualMachinesClient_InstanceView_getVirtualMachineInstanceView() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().InstanceView(ctx, "myResourceGroup", "myVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstanceView = armcompute.VirtualMachineInstanceView{ - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("https://{myStorageAccount}.blob.core.windows.net/bootdiagnostics-myOsDisk/myOsDisk.screenshot.bmp"), - // SerialConsoleLogBlobURI: to.Ptr("https://{myStorageAccount}.blob.core.windows.net/bootdiagnostics-myOsDisk/myOsDisk.serialconsole.log"), - // }, - // ComputerName: to.Ptr("myVM"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("myOsDisk"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T21:29:47.477089+00:00"); return t}()), - // }}, - // }, - // { - // Name: to.Ptr("myDataDisk0"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T21:29:47.461517+00:00"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // OSName: to.Ptr("Windows Server 2016 Datacenter"), - // OSVersion: to.Ptr("Microsoft Windows NT 10.0.14393.0"), - // PatchStatus: &armcompute.VirtualMachinePatchStatus{ - // AvailablePatchSummary: &armcompute.AvailablePatchSummary{ - // AssessmentActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // CriticalAndSecurityPatchCount: to.Ptr[int32](1), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // OtherPatchCount: to.Ptr[int32](2), - // RebootPending: to.Ptr(true), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // }, - // ConfigurationStatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("PatchModeConfigurationState/Ready"), - // DisplayStatus: to.Ptr("Status_PatchModeConfigurationState_Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // }, - // { - // Code: to.Ptr("AssessmentModeConfigurationState/Pending"), - // DisplayStatus: to.Ptr("Status_AssessmentModeConfigurationState_Pending"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // }}, - // LastPatchInstallationSummary: &armcompute.LastPatchInstallationSummary{ - // ExcludedPatchCount: to.Ptr[int32](1), - // FailedPatchCount: to.Ptr[int32](1), - // InstallationActivityID: to.Ptr("68f8b292-dfc2-4646-9981-33cc88631968"), - // InstalledPatchCount: to.Ptr[int32](1), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // MaintenanceWindowExceeded: to.Ptr(false), - // NotSelectedPatchCount: to.Ptr[int32](1), - // PendingPatchCount: to.Ptr[int32](1), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](1), - // PlatformUpdateDomain: to.Ptr[int32](1), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T21:30:12.8051917+00:00"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/running"), - // DisplayStatus: to.Ptr("VM running"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - // { - // Type: to.Ptr("Microsoft.Azure.Security.IaaSAntimalware"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }, - // TypeHandlerVersion: to.Ptr("1.5.5.9"), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("GuestAgent is running and accepting new configurations."), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-14T23:11:22+00:00"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("2.7.41491.949"), - // }, - // Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - // { - // Name: to.Ptr("IaaSAntiMalware-ext0"), - // Type: to.Ptr("Microsoft.Azure.Security.IaaSAntimalware"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("Microsoft Antimalware enabled"), - // }}, - // TypeHandlerVersion: to.Ptr("1.5.5.9"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json -func ExampleVirtualMachinesClient_InstanceView_getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().InstanceView(ctx, "myResourceGroup", "myVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstanceView = armcompute.VirtualMachineInstanceView{ - // AssignedHost: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup/hosts/myHost"), - // ComputerName: to.Ptr("myVM"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("myOsDisk"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T21:29:47.477089+00:00"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // OSName: to.Ptr("Windows Server 2016 Datacenter"), - // OSVersion: to.Ptr("Microsoft Windows NT 10.0.14393.0"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T21:30:12.8051917+00:00"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/running"), - // DisplayStatus: to.Ptr("VM running"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("GuestAgent is running and accepting new configurations."), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T23:11:22+00:00"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("2.7.41491.949"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_ConvertToManagedDisks_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginConvertToManagedDisks_virtualMachinesConvertToManagedDisksMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginConvertToManagedDisks(ctx, "rgcompute", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_ConvertToManagedDisks_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginConvertToManagedDisks_virtualMachinesConvertToManagedDisksMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginConvertToManagedDisks(ctx, "rgcompute", "aaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginDeallocate_virtualMachinesDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaa", &armcompute.VirtualMachinesClientBeginDeallocateOptions{Hibernate: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginDeallocate_virtualMachinesDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", &armcompute.VirtualMachinesClientBeginDeallocateOptions{Hibernate: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Generalize.json -func ExampleVirtualMachinesClient_Generalize() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachinesClient().Generalize(ctx, "myResourceGroup", "myVMName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_List_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_NewListPager_virtualMachinesListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListPager("rgcompute", &armcompute.VirtualMachinesClientListOptions{Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // DscpConfiguration: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodDynamic), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // CustomData: to.Ptr("aaaa"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](8), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT10M"), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaa"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](127), - // EncryptionSettings: &armcompute.DiskEncryptionSettings{ - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }, - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // UserData: to.Ptr("aaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // InstanceView: &armcompute.VirtualMachineInstanceView{ - // AssignedHost: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // }, - // ComputerName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("a"), - // EncryptionSettings: []*armcompute.DiskEncryptionSettings{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // MaintenanceRedeployStatus: &armcompute.MaintenanceRedeployStatus{ - // IsCustomerInitiatedMaintenanceAllowed: to.Ptr(true), - // LastOperationMessage: to.Ptr("aa"), - // LastOperationResultCode: to.Ptr(armcompute.MaintenanceOperationResultCodeTypesNone), - // MaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // MaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // PreMaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // PreMaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // }, - // OSName: to.Ptr("aaaaaaaaaaa"), - // OSVersion: to.Ptr("aaaaaaaaaaaaaa"), - // PatchStatus: &armcompute.VirtualMachinePatchStatus{ - // AvailablePatchSummary: &armcompute.AvailablePatchSummary{ - // AssessmentActivityID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // CriticalAndSecurityPatchCount: to.Ptr[int32](22), - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaa"), - // Target: to.Ptr("aaaaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aaaaaaaaaaaaa"), - // Target: to.Ptr("aaaaaa"), - // }}, - // }, - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // OtherPatchCount: to.Ptr[int32](25), - // RebootPending: to.Ptr(true), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusUnknown), - // }, - // ConfigurationStatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // LastPatchInstallationSummary: &armcompute.LastPatchInstallationSummary{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaa"), - // Target: to.Ptr("aaaaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aaaaaaaaaaaaa"), - // Target: to.Ptr("aaaaaa"), - // }}, - // }, - // ExcludedPatchCount: to.Ptr[int32](1), - // FailedPatchCount: to.Ptr[int32](30), - // InstallationActivityID: to.Ptr("aaaaaa"), - // InstalledPatchCount: to.Ptr[int32](28), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // MaintenanceWindowExceeded: to.Ptr(true), - // NotSelectedPatchCount: to.Ptr[int32](20), - // PendingPatchCount: to.Ptr[int32](2), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusUnknown), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](29), - // PlatformUpdateDomain: to.Ptr[int32](1), - // RdpThumbPrint: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - // { - // Type: to.Ptr("aaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // VMHealth: &armcompute.VirtualMachineHealthStatus{ - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // }, - // Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // DscpConfiguration: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodDynamic), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](11), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT10M"), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ExactVersion: to.Ptr("aa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](127), - // EncryptionSettings: &armcompute.DiskEncryptionSettings{ - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }, - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.685Z"); return t}()), - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_List_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_NewListPager_virtualMachinesListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListPager("rgcompute", &armcompute.VirtualMachinesClientListOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Location: to.Ptr("eastus"), - // }, - // { - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_ListAll_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_NewListAllPager_virtualMachinesListAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: to.Ptr("aaaaaa"), - Filter: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // DscpConfiguration: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodDynamic), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // CustomData: to.Ptr("aaaa"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](8), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT10M"), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaa"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](127), - // EncryptionSettings: &armcompute.DiskEncryptionSettings{ - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }, - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // UserData: to.Ptr("aaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // { - // Name: to.Ptr("{virtualMachineName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key5688": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Order: to.Ptr[int32](4), - // PackageReferenceID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Tags: to.Ptr("aaaaa"), - // }}, - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](26), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](7), - // VCPUsPerCore: to.Ptr[int32](14), - // }, - // }, - // Host: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // InstanceView: &armcompute.VirtualMachineInstanceView{ - // AssignedHost: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // }, - // ComputerName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("a"), - // EncryptionSettings: []*armcompute.DiskEncryptionSettings{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // }}, - // HyperVGeneration: to.Ptr(armcompute.HyperVGenerationTypeV1), - // MaintenanceRedeployStatus: &armcompute.MaintenanceRedeployStatus{ - // IsCustomerInitiatedMaintenanceAllowed: to.Ptr(true), - // LastOperationMessage: to.Ptr("aa"), - // LastOperationResultCode: to.Ptr(armcompute.MaintenanceOperationResultCodeTypesNone), - // MaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // MaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // PreMaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // PreMaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // }, - // OSName: to.Ptr("aaaaaaaaaaa"), - // OSVersion: to.Ptr("aaaaaaaaaaaaaa"), - // PatchStatus: &armcompute.VirtualMachinePatchStatus{ - // AvailablePatchSummary: &armcompute.AvailablePatchSummary{ - // AssessmentActivityID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // CriticalAndSecurityPatchCount: to.Ptr[int32](22), - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaa"), - // Target: to.Ptr("aaaaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aaaaaaaaaaaaa"), - // Target: to.Ptr("aaaaaa"), - // }}, - // }, - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // OtherPatchCount: to.Ptr[int32](25), - // RebootPending: to.Ptr(true), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.682Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusUnknown), - // }, - // ConfigurationStatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // LastPatchInstallationSummary: &armcompute.LastPatchInstallationSummary{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaa"), - // Target: to.Ptr("aaaaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aaaaaaaaaaaaa"), - // Target: to.Ptr("aaaaaa"), - // }}, - // }, - // ExcludedPatchCount: to.Ptr[int32](1), - // FailedPatchCount: to.Ptr[int32](30), - // InstallationActivityID: to.Ptr("aaaaaa"), - // InstalledPatchCount: to.Ptr[int32](28), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // MaintenanceWindowExceeded: to.Ptr(true), - // NotSelectedPatchCount: to.Ptr[int32](20), - // PendingPatchCount: to.Ptr[int32](2), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.683Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusUnknown), - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](29), - // PlatformUpdateDomain: to.Ptr[int32](1), - // RdpThumbPrint: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - // { - // Type: to.Ptr("aaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // VMHealth: &armcompute.VirtualMachineHealthStatus{ - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }, - // }, - // Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersion("2022-05-01")), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, - // }, - // DscpConfiguration: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{ - // { - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](23), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodDynamic), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("Test"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // KeyData: to.Ptr("aaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // PlatformFaultDomain: to.Ptr[int32](11), - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT10M"), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaa"), - // CommunityGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ExactVersion: to.Ptr("aa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20170406"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("test"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](127), - // EncryptionSettings: &armcompute.DiskEncryptionSettings{ - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }, - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.685Z"); return t}()), - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // VirtualMachineScaleSet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VMID: to.Ptr("{vmId}"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("aaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaa"), - // Tags: map[string]*string{ - // "key9428": to.Ptr("aaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaa"), - // DisplayStatus: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-14T16:43:41.657Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaa"), - // }, - // }}, - // Zones: []*string{ - // to.Ptr("aaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_ListAll_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_NewListAllPager_virtualMachinesListAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListAllPager(&armcompute.VirtualMachinesClientListAllOptions{StatusOnly: nil, - Filter: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineListResult = armcompute.VirtualMachineListResult{ - // Value: []*armcompute.VirtualMachine{ - // { - // Location: to.Ptr("eastus"), - // }, - // { - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_ListAvailableVmSizes.json -func ExampleVirtualMachinesClient_NewListAvailableSizesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListAvailableSizesPager("myResourceGroup", "myVmName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // Value: []*armcompute.VirtualMachineSize{ - // { - // Name: to.Ptr("Standard_A1_V2"), - // MaxDataDiskCount: to.Ptr[int32](2), - // MemoryInMB: to.Ptr[int32](2048), - // NumberOfCores: to.Ptr[int32](1), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](10240), - // }, - // { - // Name: to.Ptr("Standard_A2_V2"), - // MaxDataDiskCount: to.Ptr[int32](4), - // MemoryInMB: to.Ptr[int32](4096), - // NumberOfCores: to.Ptr[int32](2), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](20480), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPowerOff_virtualMachinesPowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachinesClientBeginPowerOffOptions{SkipShutdown: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPowerOff_virtualMachinesPowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachinesClientBeginPowerOffOptions{SkipShutdown: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Reapply.json -func ExampleVirtualMachinesClient_BeginReapply() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginReapply(ctx, "ResourceGroup", "VMName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_Restart_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRestart_virtualMachinesRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginRestart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_Restart_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRestart_virtualMachinesRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginRestart(ctx, "rgcompute", "aaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_Start_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginStart_virtualMachinesStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_Start_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginStart_virtualMachinesStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginStart(ctx, "rgcompute", "aaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRedeploy_virtualMachinesRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginRedeploy(ctx, "rgcompute", "a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginRedeploy_virtualMachinesRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.json -func ExampleVirtualMachinesClient_BeginReimage_reimageANonEphemeralVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginReimage(ctx, "myResourceGroup", "myVMName", &armcompute.VirtualMachinesClientBeginReimageOptions{Parameters: &armcompute.VirtualMachineReimageParameters{ - ExactVersion: to.Ptr("aaaaaa"), - OSProfile: &armcompute.OSProfileProvisioningData{ - AdminPassword: to.Ptr("{your-password}"), - CustomData: to.Ptr("{your-custom-data}"), - }, - TempDisk: to.Ptr(true), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_Reimage.json -func ExampleVirtualMachinesClient_BeginReimage_reimageAVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginReimage(ctx, "myResourceGroup", "myVMName", &armcompute.VirtualMachinesClientBeginReimageOptions{Parameters: &armcompute.VirtualMachineReimageParameters{ - TempDisk: to.Ptr(true), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.json -func ExampleVirtualMachinesClient_RetrieveBootDiagnosticsData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().RetrieveBootDiagnosticsData(ctx, "ResourceGroup", "VMName", &armcompute.VirtualMachinesClientRetrieveBootDiagnosticsDataOptions{SasURIExpirationTimeInMinutes: to.Ptr[int32](60)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RetrieveBootDiagnosticsDataResult = armcompute.RetrieveBootDiagnosticsDataResult{ - // ConsoleScreenshotBlobURI: to.Ptr("https://storageuri/vm.screenshot.bmp?{sasKey}"), - // SerialConsoleLogBlobURI: to.Ptr("https://storageuri/vm.serialconsole.log?{sasKey}"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPerformMaintenance_virtualMachinesPerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachines_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachinesClient_BeginPerformMaintenance_virtualMachinesPerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_SimulateEviction.json -func ExampleVirtualMachinesClient_SimulateEviction() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachinesClient().SimulateEviction(ctx, "ResourceGroup", "VMName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_AssessPatches.json -func ExampleVirtualMachinesClient_BeginAssessPatches() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginAssessPatches(ctx, "myResourceGroupName", "myVMName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineAssessPatchesResult = armcompute.VirtualMachineAssessPatchesResult{ - // AssessmentActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // AvailablePatches: []*armcompute.VirtualMachineSoftwarePatchProperties{ - // { - // Name: to.Ptr("Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.279.1373.0)"), - // ActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // AssessmentState: to.Ptr(armcompute.PatchAssessmentStateAvailable), - // Classifications: []*string{ - // to.Ptr("Definition Updates")}, - // KbID: to.Ptr("2267602"), - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:18:45.2830263Z"); return t}()), - // PatchID: to.Ptr("35428702-5784-4ba4-a6e0-5222258b5411"), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), - // RebootBehavior: to.Ptr(armcompute.VMGuestPatchRebootBehaviorNeverReboots), - // Version: to.Ptr(""), - // }, - // { - // Name: to.Ptr("Windows Malicious Software Removal Tool x64 - October 2018 (KB890830)"), - // ActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // AssessmentState: to.Ptr(armcompute.PatchAssessmentStateAvailable), - // Classifications: []*string{ - // to.Ptr("Update Rollups")}, - // KbID: to.Ptr("890830"), - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:18:45.2830263Z"); return t}()), - // PatchID: to.Ptr("39f9cdd1-795c-4d0e-8c0a-73ab3f31746d"), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T00:00:00Z"); return t}()), - // RebootBehavior: to.Ptr(armcompute.VMGuestPatchRebootBehaviorCanRequestReboot), - // Version: to.Ptr(""), - // }}, - // CriticalAndSecurityPatchCount: to.Ptr[int32](1), - // OtherPatchCount: to.Ptr[int32](2), - // RebootPending: to.Ptr(true), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineExamples/VirtualMachine_InstallPatches.json -func ExampleVirtualMachinesClient_BeginInstallPatches() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginInstallPatches(ctx, "myResourceGroupName", "myVMName", armcompute.VirtualMachineInstallPatchesParameters{ - MaximumDuration: to.Ptr("PT4H"), - RebootSetting: to.Ptr(armcompute.VMGuestPatchRebootSettingIfRequired), - WindowsParameters: &armcompute.WindowsParameters{ - ClassificationsToInclude: []*armcompute.VMGuestPatchClassificationWindows{ - to.Ptr(armcompute.VMGuestPatchClassificationWindowsCritical), - to.Ptr(armcompute.VMGuestPatchClassificationWindowsSecurity)}, - MaxPatchPublishDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-19T02:36:43.0539904+00:00"); return t }()), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstallPatchesResult = armcompute.VirtualMachineInstallPatchesResult{ - // ExcludedPatchCount: to.Ptr[int32](0), - // FailedPatchCount: to.Ptr[int32](0), - // InstallationActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), - // InstalledPatchCount: to.Ptr[int32](3), - // MaintenanceWindowExceeded: to.Ptr(false), - // NotSelectedPatchCount: to.Ptr[int32](0), - // Patches: []*armcompute.PatchInstallationDetail{ - // { - // Name: to.Ptr("Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.279.1373.0)"), - // Classifications: []*string{ - // to.Ptr("Definition Updates")}, - // InstallationState: to.Ptr(armcompute.PatchInstallationStateInstalled), - // KbID: to.Ptr("2267602"), - // PatchID: to.Ptr("35428702-5784-4ba4-a6e0-5222258b5411"), - // Version: to.Ptr(""), - // }, - // { - // Name: to.Ptr("Windows Malicious Software Removal Tool x64 - October 2018 (KB890830)"), - // Classifications: []*string{ - // to.Ptr("Update Rollups")}, - // InstallationState: to.Ptr(armcompute.PatchInstallationStatePending), - // KbID: to.Ptr("890830"), - // PatchID: to.Ptr("39f9cdd1-795c-4d0e-8c0a-73ab3f31746d"), - // Version: to.Ptr(""), - // }}, - // PendingPatchCount: to.Ptr[int32](2), - // RebootStatus: to.Ptr(armcompute.VMGuestPatchRebootStatusCompleted), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-24T21:02:04.2556154Z"); return t}()), - // Status: to.Ptr(armcompute.PatchOperationStatusSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineRunCommand.json -func ExampleVirtualMachinesClient_BeginRunCommand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginRunCommand(ctx, "crptestar98131", "vm3036", armcompute.RunCommandInput{ - CommandID: to.Ptr("RunPowerShellScript"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RunCommandResult = armcompute.RunCommandResult{ - // Value: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ComponentStatus/StdOut/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("This is a sample script with parameters value1 value2"), - // }, - // { - // Code: to.Ptr("ComponentStatus/StdErr/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr(""), - // }}, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go index 4e5ce4c39c5c..53149b8ee22f 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) if err != nil { @@ -110,7 +110,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) @@ -119,7 +119,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -140,7 +140,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, options) if err != nil { @@ -180,7 +180,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) deleteCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,7 +189,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -237,7 +237,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) getCreateRequest(ctx conte if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +254,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) getHandleResponse(resp *ht // NewListPager - Gets a list of all extensions in a VM scale set. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 @@ -307,7 +307,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) listCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -325,7 +325,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -347,7 +347,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) if err != nil { @@ -387,7 +387,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) updateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go deleted file mode 100644 index e1743c84c113..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetextensions_client_example_test.go +++ /dev/null @@ -1,374 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginCreateOrUpdate_virtualMachineScaleSetExtensionsCreateOrUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().BeginCreateOrUpdate(ctx, "rgcompute", "aaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetExtension{ - Name: to.Ptr("{extension-name}"), - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(true), - EnableAutomaticUpgrade: to.Ptr(true), - ForceUpdateTag: to.Ptr("aaaaaaaaa"), - ProtectedSettings: map[string]any{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginCreateOrUpdate_virtualMachineScaleSetExtensionsCreateOrUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().BeginCreateOrUpdate(ctx, "rgcompute", "aaaaaaaaaaa", "aaaaaaaaaaa", armcompute.VirtualMachineScaleSetExtension{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginUpdate_virtualMachineScaleSetExtensionsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", armcompute.VirtualMachineScaleSetExtensionUpdate{ - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(true), - EnableAutomaticUpgrade: to.Ptr(true), - ForceUpdateTag: to.Ptr("aaaaaaaaa"), - ProtectedSettings: map[string]any{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginUpdate_virtualMachineScaleSetExtensionsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", armcompute.VirtualMachineScaleSetExtensionUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Delete_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginDelete_virtualMachineScaleSetExtensionsDeleteMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().BeginDelete(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Delete_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_BeginDelete_virtualMachineScaleSetExtensionsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().BeginDelete(ctx, "rgcompute", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Get_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_Get_virtualMachineScaleSetExtensionsGetMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().Get(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetExtensionsClientGetOptions{Expand: to.Ptr("aaaaaaa")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_Get_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_Get_virtualMachineScaleSetExtensionsGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetExtensionsClient().Get(ctx, "rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetExtension = armcompute.VirtualMachineScaleSetExtension{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_NewListPager_virtualMachineScaleSetExtensionsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetExtensionsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetExtensionListResult = armcompute.VirtualMachineScaleSetExtensionListResult{ - // Value: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtensions_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetExtensionsClient_NewListPager_virtualMachineScaleSetExtensionsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetExtensionsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetExtensionListResult = armcompute.VirtualMachineScaleSetExtensionListResult{ - // Value: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go index c55556641556..b8ff0d8acc4d 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetRollingUpgradesClient) cancel(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions) (*http.Response, error) { req, err := client.cancelCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -104,7 +104,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -113,7 +113,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -153,7 +153,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -173,7 +173,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestHandleRespon // are not affected. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions contains the optional parameters @@ -195,7 +195,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartExtensionUp // are not affected. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions) (*http.Response, error) { req, err := client.startExtensionUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -231,7 +231,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,7 +242,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade // affected. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - options - VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions contains the optional parameters for the @@ -264,7 +264,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartOSUpgrade(c // affected. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions) (*http.Response, error) { req, err := client.startOSUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -300,7 +300,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgradeCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-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 2140b662357c..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetrollingupgrades_client_example_test.go +++ /dev/null @@ -1,214 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_Cancel_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginCancel_virtualMachineScaleSetRollingUpgradesCancelMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().BeginCancel(ctx, "rgcompute", "aaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_Cancel_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginCancel_virtualMachineScaleSetRollingUpgradesCancelMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().BeginCancel(ctx, "rgcompute", "aaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartOSUpgrade_virtualMachineScaleSetRollingUpgradesStartOsUpgradeMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().BeginStartOSUpgrade(ctx, "rgcompute", "aaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartOSUpgrade_virtualMachineScaleSetRollingUpgradesStartOsUpgradeMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().BeginStartOSUpgrade(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_BeginStartExtensionUpgrade() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().BeginStartExtensionUpgrade(ctx, "myResourceGroup", "{vmss-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_GetLatest_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_GetLatest_virtualMachineScaleSetRollingUpgradesGetLatestMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().GetLatest(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RollingUpgradeStatusInfo = armcompute.RollingUpgradeStatusInfo{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // ID: to.Ptr("aaaaaaaaaa"), - // Location: to.Ptr("aaaaaa"), - // Tags: map[string]*string{ - // "key8533": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.RollingUpgradeStatusInfoProperties{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaaaaaaaa"), - // Target: to.Ptr("aaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aa"), - // Target: to.Ptr("aaaa"), - // }}, - // }, - // Policy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // RollbackFailedInstancesOnPolicyBreach: to.Ptr(true), - // }, - // Progress: &armcompute.RollingUpgradeProgressInfo{ - // FailedInstanceCount: to.Ptr[int32](25), - // InProgressInstanceCount: to.Ptr[int32](20), - // PendingInstanceCount: to.Ptr[int32](27), - // SuccessfulInstanceCount: to.Ptr[int32](6), - // }, - // RunningStatus: &armcompute.RollingUpgradeRunningStatus{ - // Code: to.Ptr(armcompute.RollingUpgradeStatusCodeRollingForward), - // LastAction: to.Ptr(armcompute.RollingUpgradeActionTypeStart), - // LastActionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:06:23.362Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:06:23.362Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrades_GetLatest_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetRollingUpgradesClient_GetLatest_virtualMachineScaleSetRollingUpgradesGetLatestMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetRollingUpgradesClient().GetLatest(ctx, "rgcompute", "aaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RollingUpgradeStatusInfo = armcompute.RollingUpgradeStatusInfo{ - // Location: to.Ptr("aaaaaa"), - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go index 362e29720cd1..f42db6472d32 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client.go @@ -49,7 +49,7 @@ func NewVirtualMachineScaleSetsClient(subscriptionID string, credential azcore.T // 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 2022-11-01 +// Generated from API version 2023-03-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. @@ -90,7 +90,7 @@ func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupCreate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -99,7 +99,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -120,7 +120,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { @@ -156,7 +156,7 @@ func (client *VirtualMachineScaleSetsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -167,7 +167,7 @@ func (client *VirtualMachineScaleSetsClient) createOrUpdateCreateRequest(ctx con // scale set deallocates. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 @@ -189,7 +189,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeallocateOptions) (*http.Response, error) { req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -225,7 +225,10 @@ func (client *VirtualMachineScaleSetsClient) deallocateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + if options != nil && options.Hibernate != nil { + reqQP.Set("hibernate", strconv.FormatBool(*options.Hibernate)) + } + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -237,7 +240,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -257,7 +260,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -296,7 +299,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -305,7 +308,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -326,7 +329,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) deleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginDeleteInstancesOptions) (*http.Response, error) { req, err := client.deleteInstancesCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) if err != nil { @@ -365,7 +368,7 @@ func (client *VirtualMachineScaleSetsClient) deleteInstancesCreateRequest(ctx co if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, vmInstanceIDs) @@ -375,7 +378,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -416,7 +419,7 @@ func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformU return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") reqQP.Set("platformUpdateDomain", strconv.FormatInt(int64(platformUpdateDomain), 10)) if options != nil && options.Zone != nil { reqQP.Set("zone", *options.Zone) @@ -441,7 +444,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -481,7 +484,7 @@ func (client *VirtualMachineScaleSetsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -502,7 +505,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -542,7 +545,7 @@ func (client *VirtualMachineScaleSetsClient) getInstanceViewCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -559,7 +562,7 @@ func (client *VirtualMachineScaleSetsClient) getInstanceViewHandleResponse(resp // NewGetOSUpgradeHistoryPager - Gets list of OS upgrades on a VM scale set instance. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 @@ -612,7 +615,7 @@ func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -629,7 +632,7 @@ func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryHandleResponse(r // NewListPager - Gets a list of all VM scale sets under a resource group. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - options - VirtualMachineScaleSetsClientListOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListPager // method. @@ -677,7 +680,7 @@ func (client *VirtualMachineScaleSetsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -696,7 +699,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 2022-11-01 +// Generated from API version 2023-03-01 // - options - VirtualMachineScaleSetsClientListAllOptions contains the optional parameters for the VirtualMachineScaleSetsClient.NewListAllPager // method. func (client *VirtualMachineScaleSetsClient) NewListAllPager(options *VirtualMachineScaleSetsClientListAllOptions) *runtime.Pager[VirtualMachineScaleSetsClientListAllResponse] { @@ -739,7 +742,7 @@ func (client *VirtualMachineScaleSetsClient) listAllCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -756,7 +759,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -804,7 +807,7 @@ func (client *VirtualMachineScaleSetsClient) listByLocationCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -822,7 +825,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -875,7 +878,7 @@ func (client *VirtualMachineScaleSetsClient) listSKUsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -895,7 +898,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -917,7 +920,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions) (*http.Response, error) { req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -953,7 +956,7 @@ func (client *VirtualMachineScaleSetsClient) performMaintenanceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -967,7 +970,7 @@ func (client *VirtualMachineScaleSetsClient) performMaintenanceCreateRequest(ctx // avoid charges. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 @@ -989,7 +992,7 @@ func (client *VirtualMachineScaleSetsClient) BeginPowerOff(ctx context.Context, // avoid charges. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPowerOffOptions) (*http.Response, error) { req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1028,7 +1031,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1037,11 +1040,78 @@ func (client *VirtualMachineScaleSetsClient) powerOffCreateRequest(ctx context.C return req, nil } +// 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-03-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 +// method. +func (client *VirtualMachineScaleSetsClient) BeginReapply(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReapplyOptions) (*runtime.Poller[VirtualMachineScaleSetsClientReapplyResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reapply(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachineScaleSetsClientReapplyResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientReapplyResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// 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-03-01 +func (client *VirtualMachineScaleSetsClient) reapply(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReapplyOptions) (*http.Response, error) { + req, err := client.reapplyCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// reapplyCreateRequest creates the Reapply request. +func (client *VirtualMachineScaleSetsClient) reapplyCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReapplyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reapply" + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginRedeploy - Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers // them back on. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 @@ -1062,7 +1132,7 @@ func (client *VirtualMachineScaleSetsClient) BeginRedeploy(ctx context.Context, // back on. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1098,7 +1168,7 @@ func (client *VirtualMachineScaleSetsClient) redeployCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1112,7 +1182,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1134,7 +1204,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1170,7 +1240,7 @@ func (client *VirtualMachineScaleSetsClient) reimageCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMScaleSetReimageInput != nil { @@ -1183,7 +1253,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1204,7 +1274,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageAllOptions) (*http.Response, error) { req, err := client.reimageAllCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1240,7 +1310,7 @@ func (client *VirtualMachineScaleSetsClient) reimageAllCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1252,7 +1322,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1272,7 +1342,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1308,7 +1378,7 @@ func (client *VirtualMachineScaleSetsClient) restartCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1320,7 +1390,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -1341,7 +1411,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceState(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsClientBeginSetOrchestrationServiceStateOptions) (*http.Response, error) { req, err := client.setOrchestrationServiceStateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { @@ -1377,7 +1447,7 @@ func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -1386,7 +1456,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 2022-11-01 +// Generated from API version 2023-03-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 @@ -1406,7 +1476,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { @@ -1442,7 +1512,7 @@ func (client *VirtualMachineScaleSetsClient) startCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMInstanceIDs != nil { @@ -1454,7 +1524,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -1475,7 +1545,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { @@ -1511,7 +1581,7 @@ func (client *VirtualMachineScaleSetsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -1520,7 +1590,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -1541,7 +1611,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetsClient) updateInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginUpdateInstancesOptions) (*http.Response, error) { req, err := client.updateInstancesCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) if err != nil { @@ -1577,7 +1647,7 @@ func (client *VirtualMachineScaleSetsClient) updateInstancesCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, vmInstanceIDs) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go deleted file mode 100644 index 2eff5982d4e4..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesets_client_example_test.go +++ /dev/null @@ -1,9571 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListBySubscription_ByLocation.json -func ExampleVirtualMachineScaleSetsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListByLocationPager("eastus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListResult = armcompute.VirtualMachineScaleSetListResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue2"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic1"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAVmssWithAnExtensionThatHasSuppressFailuresEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - { - Name: to.Ptr("{extension-name}"), - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(false), - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }}, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // Name: to.Ptr("{extension-name}"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAVmssWithAnExtensionWithProtectedSettingsFromKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - { - Name: to.Ptr("{extension-name}"), - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(false), - ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{ - SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"), - }, - }, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }}, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // Name: to.Ptr("{extension-name}"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // ProtectedSettingsFromKeyVault: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName"), - // }, - // }, - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Name: to.Ptr("osDisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - Image: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd"), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d6e9ab29-f8c9-4792-978c-ae2c07b98f17"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("osDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{existing-storage-account-name}.blob.core.windows.net/system/Microsoft.Compute/Images/vhds/{existing-generalized-os-image-blob-name}.vhd"), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAPlatformImageScaleSetWithUnmanagedOsDisks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Name: to.Ptr("osDisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - VhdContainers: []*string{ - to.Ptr("http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer"), - to.Ptr("http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer"), - to.Ptr("http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer"), - to.Ptr("http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer"), - to.Ptr("http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer")}, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("77b7df9a-32fe-45e3-8911-60ac9c9b9c64"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("osDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // VhdContainers: []*string{ - // to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/vhds")}, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetFromACustomImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetFromAGeneralizedSharedImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetFromASpecializedSharedImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWhereNicConfigHasDisableTcpStateTrackingProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{nicConfig1-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - DisableTCPStateTracking: to.Ptr(true), - EnableAcceleratedNetworking: to.Ptr(true), - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }, - { - Name: to.Ptr("{nicConfig2-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - DisableTCPStateTracking: to.Ptr(false), - EnableAcceleratedNetworking: to.Ptr(false), - EnableIPForwarding: to.Ptr(false), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{nicConfig2-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Primary: to.Ptr(true), - PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name2}"), - }, - }, - }}, - Primary: to.Ptr(false), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{nicConfig1-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DisableTCPStateTracking: to.Ptr(true), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{nicConfig1-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("{nicConfig2-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DisableTCPStateTracking: to.Ptr(false), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableFpga: to.Ptr(false), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{nicConfig2-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name2}"), - // }, - // }, - // }}, - // Primary: to.Ptr(false), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithApplicationProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - ApplicationProfile: &armcompute.ApplicationProfile{ - GalleryApplications: []*armcompute.VMGalleryApplication{ - { - ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - EnableAutomaticUpgrade: to.Ptr(false), - Order: to.Ptr[int32](1), - PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - Tags: to.Ptr("myTag1"), - TreatFailureAsDeploymentFailure: to.Ptr(true), - }, - { - PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - }}, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("ffb27c5c-39a5-4d4e-b307-b32598689813"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // Order: to.Ptr[int32](1), - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - // Tags: to.Ptr("myTag1"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithDiskControllerType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - HardwareProfile: &armcompute.VirtualMachineScaleSetHardwareProfile{ - VMSizeProperties: &armcompute.VMSizeProperties{ - VCPUsAvailable: to.Ptr[int32](1), - VCPUsPerCore: to.Ptr[int32](1), - }, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - DiskControllerType: to.Ptr("NVMe"), - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // HardwareProfile: &armcompute.VirtualMachineScaleSetHardwareProfile{ - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](1), - // VCPUsPerCore: to.Ptr[int32](1), - // }, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DiskControllerType: to.Ptr("NVMe"), - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithDiskEncryptionSetResourceInOsDiskAndDataDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - { - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }}, - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithFpgaNetworkInterfaces() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }, - { - Name: to.Ptr("{fpgaNic-Name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableAcceleratedNetworking: to.Ptr(false), - EnableFpga: to.Ptr(true), - EnableIPForwarding: to.Ptr(false), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{fpgaNic-Name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Primary: to.Ptr(true), - PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(false), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("afa2afa8-9e49-48fb-9d18-c86323b5d064"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("{fpgaNic-Name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableFpga: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{fpgaNic-Name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}"), - // }, - // }, - // }}, - // Primary: to.Ptr(false), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/nsgcustom"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - EncryptionAtHost: to.Ptr(true), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithOsImageScheduledEventsEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT15M"), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // OSImageNotificationProfile: &armcompute.OSImageNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT15M"), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSecurityTypeAsConfidentialVm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("2019-datacenter-cvm"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("windows-cvm"), - Version: to.Ptr("17763.2183.2109130127"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - SecurityProfile: &armcompute.VMDiskSecurityProfile{ - SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DC2as_v5"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesConfidentialVM), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("2019-datacenter-cvm"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("windows-cvm"), - // Version: to.Ptr("17763.2183.2109130127"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // SecurityProfile: &armcompute.VMDiskSecurityProfile{ - // SecurityEncryptionType: to.Ptr(armcompute.SecurityEncryptionTypesVMGuestStateOnly), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DC2as_v5"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithServiceArtifactReference() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("eastus2euap"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - EnableAutomaticOSUpgrade: to.Ptr(true), - }, - Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - ServiceArtifactReference: &armcompute.ServiceArtifactReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/serviceArtifacts/serviceArtifactName/vmArtifactsProfiles/vmArtifactsProfilesName"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2022-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Name: to.Ptr("osDisk"), - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_A1"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("77b7df9a-32fe-45e3-8911-60ac9c9b9c64"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ServiceArtifactReference: &armcompute.ServiceArtifactReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/serviceArtifacts/serviceArtifactName/vmArtifactsProfiles/vmArtifactsProfilesName"), - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2022-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("osDisk"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_A1"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithUefiSettingsOfSecureBootAndVTpm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - SecurityProfile: &armcompute.SecurityProfile{ - SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windowsserver-gen2preview-preview"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("windows10-tvm"), - Version: to.Ptr("18363.592.2001092016"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D2s_v3"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("windowsserver-gen2preview-preview"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("windows10-tvm"), - // Version: to.Ptr("18363.592.2001092016"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardSSDLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAMarketplaceImagePlan() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAnAzureApplicationGateway() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}"), - }}, - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("a0134477-b9d9-484b-b0e3-205c1c089ffa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/nsgExistingAppGw/backendAddressPools/appGatewayBackendPool"), - // }}, - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAnAzureLoadBalancer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}"), - }}, - LoadBalancerInboundNatPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}"), - }}, - PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - }, - }, - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("ec0b21ca-51ec-414b-9323-f236ffc21479"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/myLb/backendAddressPools/lbBackendPool"), - // }}, - // LoadBalancerInboundNatPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/myLb/inboundNatPools/lbNatPool"), - // }}, - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithAutomaticRepairsEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - Enabled: to.Ptr(true), - GracePeriod: to.Ptr("PT10M"), - }, - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("PT10M"), - // }, - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithBootDiagnostics() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithEmptyDataDisksOnEachVm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiskSizeGB: to.Ptr[int32](512), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D2_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("8042c376-4690-4c47-9fa2-fbdad70e32fa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](512), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithEphemeralOsDisksUsingPlacementProperty() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - Placement: to.Ptr(armcompute.DiffDiskPlacementResourceDisk), - }, - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementResourceDisk), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithEphemeralOsDisks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("windows-data-science-vm"), - Publisher: to.Ptr("microsoft-ads"), - SKU: to.Ptr("windows2016"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadOnly), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - }, - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("standard-data-science-vm"), - // Product: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("b9e23088-6ffc-46e0-9e02-b0a6eeef47db"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("standard-data-science-vm"), - // Publisher: to.Ptr("microsoft-ads"), - // SKU: to.Ptr("standard-data-science-vm"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadOnly), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithExtensionTimeBudget() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - ExtensionsTimeBudget: to.Ptr("PT1H20M"), - Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - { - Name: to.Ptr("{extension-name}"), - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(false), - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }}, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("PT1H20M"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // Name: to.Ptr("{extension-name}"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithManagedBootDiagnostics() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - }, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithPasswordAuthentication() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("ffb27c5c-39a5-4d4e-b307-b32598689813"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithPremiumStorage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("19fd38a2-f50a-42c6-9dc7-3f9cf3791225"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithPriorityMixPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - OrchestrationMode: to.Ptr(armcompute.OrchestrationModeFlexible), - PriorityMixPolicy: &armcompute.PriorityMixPolicy{ - BaseRegularPriorityCount: to.Ptr[int32](4), - RegularPriorityPercentageAboveBase: to.Ptr[int32](50), - }, - SinglePlacementGroup: to.Ptr(false), - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - BillingProfile: &armcompute.BillingProfile{ - MaxPrice: to.Ptr[float64](-1), - }, - EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesSpot), - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_A8m_v2"), - Capacity: to.Ptr[int64](10), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeFlexible), - // PriorityMixPolicy: &armcompute.PriorityMixPolicy{ - // BaseRegularPriorityCount: to.Ptr[int32](4), - // RegularPriorityPercentageAboveBase: to.Ptr[int32](50), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](-1), - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesSpot), - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_A8m_v2"), - // Capacity: to.Ptr[int64](10), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithScaleInPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - ScaleInPolicy: &armcompute.ScaleInPolicy{ - ForceDeletion: to.Ptr(true), - Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesOldestVM)}, - }, - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesOldestVM)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSpotRestorePolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - Enabled: to.Ptr(true), - RestoreTimeout: to.Ptr("PT1H"), - }, - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - BillingProfile: &armcompute.BillingProfile{ - MaxPrice: to.Ptr[float64](-1), - }, - EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesSpot), - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_A8m_v2"), - Capacity: to.Ptr[int64](2), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("PT1H"), - // }, - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](-1), - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesSpot), - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_A8m_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithSshAuthentication() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armcompute.SSHConfiguration{ - PublicKeys: []*armcompute.SSHPublicKey{ - { - Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"), - KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"), - }}, - }, - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("fb73af19-0090-467c-9ced-b00bceab1c45"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"), - // KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("UbuntuServer"), - // Publisher: to.Ptr("Canonical"), - // SKU: to.Ptr("16.04-LTS"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithTerminateScheduledEventsEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT5M"), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT5M"), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithUserData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithVirtualMachinesInDifferentZones() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("centralus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](0), - }, - { - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](1), - }}, - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DiskSizeGB: to.Ptr[int32](512), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_A1_v2"), - Capacity: to.Ptr[int64](2), - Tier: to.Ptr("Standard"), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("3")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("centralus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UniqueID: to.Ptr("8042c376-4690-4c47-9fa2-fbdad70e32fa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](0), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // { - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }}, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](512), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // ZoneBalance: to.Ptr(false), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_A1_v2"), - // Capacity: to.Ptr[int64](2), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createAScaleSetWithVmSizeProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - HardwareProfile: &armcompute.VirtualMachineScaleSetHardwareProfile{ - VMSizeProperties: &armcompute.VMSizeProperties{ - VCPUsAvailable: to.Ptr[int32](1), - VCPUsPerCore: to.Ptr[int32](1), - }, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_D1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://nsgdiagnostic.blob.core.windows.net"), - // }, - // }, - // HardwareProfile: &armcompute.VirtualMachineScaleSetHardwareProfile{ - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](1), - // VCPUsPerCore: to.Ptr[int32](1), - // }, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.json -func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate_createOrUpdateAScaleSetWithCapacityReservation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{vmss-name}", armcompute.VirtualMachineScaleSet{ - Location: to.Ptr("westus"), - Properties: &armcompute.VirtualMachineScaleSetProperties{ - Overprovision: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - Mode: to.Ptr(armcompute.UpgradeModeManual), - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - CapacityReservation: &armcompute.CapacityReservationProfile{ - CapacityReservationGroup: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"), - }, - }, - NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - Name: to.Ptr("{vmss-name}"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - }, - }, - }}, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - AdminPassword: to.Ptr("{your-password}"), - AdminUsername: to.Ptr("{your-username}"), - ComputerNamePrefix: to.Ptr("{vmss-name}"), - }, - StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcompute.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - }, - }, - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Standard_DS1_v2"), - Capacity: to.Ptr[int64](3), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{vmss-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // Overprovision: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(true), - // UniqueID: to.Ptr("d053ec5a-8da6-495f-ab13-38216503c6d7"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"), - // }, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/nsgExistingVnet/subnets/nsgExistingSubnet"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_DS1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdate_virtualMachineScaleSetsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetUpdate{ - Tags: map[string]*string{ - "key246": to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - }, - Identity: &armcompute.VirtualMachineScaleSetIdentity{ - Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - "key3951": {}, - }, - }, - Plan: &armcompute.Plan{ - Name: to.Ptr("windows2016"), - Product: to.Ptr("windows-data-science-vm"), - PromotionCode: to.Ptr("aaaaaaaaaa"), - Publisher: to.Ptr("microsoft-ads"), - }, - Properties: &armcompute.VirtualMachineScaleSetUpdateProperties{ - AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - HibernationEnabled: to.Ptr(true), - UltraSSDEnabled: to.Ptr(true), - }, - AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - Enabled: to.Ptr(true), - GracePeriod: to.Ptr("PT30M"), - }, - DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - Overprovision: to.Ptr(true), - ProximityPlacementGroup: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - ScaleInPolicy: &armcompute.ScaleInPolicy{ - ForceDeletion: to.Ptr(true), - Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesOldestVM)}, - }, - SinglePlacementGroup: to.Ptr(true), - UpgradePolicy: &armcompute.UpgradePolicy{ - AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - DisableAutomaticRollback: to.Ptr(true), - EnableAutomaticOSUpgrade: to.Ptr(true), - }, - Mode: to.Ptr(armcompute.UpgradeModeManual), - RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - EnableCrossZoneUpgrade: to.Ptr(true), - MaxBatchInstancePercent: to.Ptr[int32](49), - MaxSurge: to.Ptr(true), - MaxUnhealthyInstancePercent: to.Ptr[int32](81), - MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - PrioritizeUnhealthyInstances: to.Ptr(true), - RollbackFailedInstancesOnPolicyBreach: to.Ptr(true), - }, - }, - VirtualMachineProfile: &armcompute.VirtualMachineScaleSetUpdateVMProfile{ - BillingProfile: &armcompute.BillingProfile{ - MaxPrice: to.Ptr[float64](-1), - }, - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - }, - }, - ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - ExtensionsTimeBudget: to.Ptr("PT1H20M"), - Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - { - Name: to.Ptr("{extension-name}"), - Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - Type: to.Ptr("{extension-Type}"), - AutoUpgradeMinorVersion: to.Ptr(true), - EnableAutomaticUpgrade: to.Ptr(true), - ForceUpdateTag: to.Ptr("aaaaaaaaa"), - ProtectedSettings: map[string]any{}, - ProvisionAfterExtensions: []*string{ - to.Ptr("aa")}, - Publisher: to.Ptr("{extension-Publisher}"), - Settings: map[string]any{}, - SuppressFailures: to.Ptr(true), - TypeHandlerVersion: to.Ptr("{handler-version}"), - }, - }}, - }, - LicenseType: to.Ptr("aaaaaaaaaaaa"), - NetworkProfile: &armcompute.VirtualMachineScaleSetUpdateNetworkProfile{ - HealthProbe: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"), - }, - NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetUpdateNetworkConfiguration{ - { - ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - Name: to.Ptr("aaaaaaaa"), - Properties: &armcompute.VirtualMachineScaleSetUpdateNetworkConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - DNSServers: []*string{}, - }, - EnableAcceleratedNetworking: to.Ptr(true), - EnableFpga: to.Ptr(true), - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetUpdateIPConfiguration{ - { - ID: to.Ptr("aaaaaaaaaaaaaaaa"), - Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - Properties: &armcompute.VirtualMachineScaleSetUpdateIPConfigurationProperties{ - ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }}, - ApplicationSecurityGroups: []*armcompute.SubResource{ - { - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }}, - LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }}, - LoadBalancerInboundNatPools: []*armcompute.SubResource{ - { - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }}, - Primary: to.Ptr(true), - PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration{ - Name: to.Ptr("a"), - Properties: &armcompute.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - }, - IdleTimeoutInMinutes: to.Ptr[int32](3), - }, - }, - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"), - }, - }, - }}, - NetworkSecurityGroup: &armcompute.SubResource{ - ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - }, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.VirtualMachineScaleSetUpdateOSProfile{ - CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - DisablePasswordAuthentication: to.Ptr(true), - PatchSettings: &armcompute.LinuxPatchSettings{ - AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - }, - ProvisionVMAgent: to.Ptr(true), - SSH: &armcompute.SSHConfiguration{ - PublicKeys: []*armcompute.SSHPublicKey{ - { - Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"), - KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"), - }}, - }, - }, - Secrets: []*armcompute.VaultSecretGroup{ - { - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - VaultCertificates: []*armcompute.VaultCertificate{ - { - CertificateStore: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - CertificateURL: to.Ptr("aaaaaaa"), - }}, - }}, - WindowsConfiguration: &armcompute.WindowsConfiguration{ - AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - { - ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - PassName: to.Ptr("OobeSystem"), - SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - }}, - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - AutomaticByPlatformSettings: &armcompute.WindowsVMGuestPatchAutomaticByPlatformSettings{ - RebootSetting: to.Ptr(armcompute.WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), - }, - EnableHotpatching: to.Ptr(true), - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - }, - ProvisionVMAgent: to.Ptr(true), - TimeZone: to.Ptr("aaaaaaaaaaaaaaaa"), - WinRM: &armcompute.WinRMConfiguration{ - Listeners: []*armcompute.WinRMListener{ - { - CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - }}, - }, - }, - }, - ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - Enable: to.Ptr(true), - NotBeforeTimeout: to.Ptr("PT10M"), - }, - }, - SecurityProfile: &armcompute.SecurityProfile{ - EncryptionAtHost: to.Ptr(true), - SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.VirtualMachineScaleSetUpdateStorageProfile{ - DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - { - Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - Caching: to.Ptr(armcompute.CachingTypesNone), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DiskIOPSReadWrite: to.Ptr[int64](28), - DiskMBpsReadWrite: to.Ptr[int64](15), - DiskSizeGB: to.Ptr[int32](1023), - Lun: to.Ptr[int32](26), - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("aaaaaaaaaaaa"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - WriteAcceleratorEnabled: to.Ptr(true), - }}, - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SharedGalleryImageID: to.Ptr("aaaaaa"), - SKU: to.Ptr("2016-Datacenter"), - Version: to.Ptr("latest"), - }, - OSDisk: &armcompute.VirtualMachineScaleSetUpdateOSDisk{ - Caching: to.Ptr(armcompute.CachingTypesReadWrite), - DiskSizeGB: to.Ptr[int32](6), - Image: &armcompute.VirtualHardDisk{ - URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"), - }, - ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("aaaaaaaaaaaa"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - VhdContainers: []*string{ - to.Ptr("aa")}, - WriteAcceleratorEnabled: to.Ptr(true), - }, - }, - UserData: to.Ptr("aaaaaaaaaaaaa"), - }, - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("DSv3-Type1"), - Capacity: to.Ptr[int64](7), - Tier: to.Ptr("aaa"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key8425": to.Ptr("aaa"), - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("PT30M"), - // }, - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesOldestVM)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaaaaa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // DisableAutomaticRollback: to.Ptr(true), - // EnableAutomaticOSUpgrade: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](-1), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("PT1H20M"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("{extension-name}"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("{extension-Type}"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("{extension-Publisher}"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("{handler-version}"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }}, - // LoadBalancerInboundNatPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - // Name: to.Ptr("a"), - // Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - // DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](3), - // IPTags: []*armcompute.VirtualMachineScaleSetIPTag{ - // { - // IPTagType: to.Ptr("aaaaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("/home/{your-username}/.ssh/authorized_keys"), - // KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // { - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VaultCertificates: []*armcompute.VaultCertificate{ - // { - // CertificateStore: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // CertificateURL: to.Ptr("aaaaaaa"), - // }}, - // }}, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // AutomaticByPlatformSettings: &armcompute.WindowsVMGuestPatchAutomaticByPlatformSettings{ - // RebootSetting: to.Ptr(armcompute.WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), - // }, - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeAutomaticByPlatform), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("PT10M"), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskIOPSReadWrite: to.Ptr[int64](28), - // DiskMBpsReadWrite: to.Ptr[int64](15), - // DiskSizeGB: to.Ptr[int32](1023), - // Lun: to.Ptr[int32](26), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // WriteAcceleratorEnabled: to.Ptr(true), - // }}, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaa"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](6), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaaaaaaaaaaaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdate_virtualMachineScaleSetsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.json -func ExampleVirtualMachineScaleSetsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", &armcompute.VirtualMachineScaleSetsClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.json -func ExampleVirtualMachineScaleSetsClient_Get_getVmScaleSetVmWithDiskControllerType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // Order: to.Ptr[int32](1), - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - // Tags: to.Ptr("myTag1"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // DiskControllerType: to.Ptr("NVMe"), - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.json -func ExampleVirtualMachineScaleSetsClient_Get_getAVirtualMachineScaleSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T01:02:38.3138469+00:00"); return t}()), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // Order: to.Ptr[int32](1), - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - // Tags: to.Ptr("myTag1"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.json -func ExampleVirtualMachineScaleSetsClient_Get_getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.json -func ExampleVirtualMachineScaleSetsClient_Get_getAVirtualMachineScaleSetWithUserData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().Get(ctx, "myResourceGroup", "myVirtualMachineScaleSet", &armcompute.VirtualMachineScaleSetsClientGetOptions{Expand: to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSet = armcompute.VirtualMachineScaleSet{ - // Name: to.Ptr("myVirtualMachineScaleSet"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVirtualMachineScaleSet"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(false), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup"), - // }, - // Overprovision: to.Ptr(false), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // SinglePlacementGroup: to.Ptr(false), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // EnableAutomaticOSUpgrade: to.Ptr(false), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), - // Order: to.Ptr[int32](1), - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0"), - // Tags: to.Ptr("myTag1"), - // }, - // { - // PackageReferenceID: to.Ptr("/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"), - // }}, - // }, - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // Primary: to.Ptr(true), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("myVirtualMachineScaleSet"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(false), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](30), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // }, - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeallocate_virtualMachineScaleSetsDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginDeallocateOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeallocate_virtualMachineScaleSetsDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginDeallocateOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_DeleteInstances_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeleteInstances_virtualMachineScaleSetsDeleteInstancesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginDeleteInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - }, &armcompute.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions{ForceDeletion: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_DeleteInstances_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginDeleteInstances_virtualMachineScaleSetsDeleteInstancesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginDeleteInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - }, &armcompute.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions{ForceDeletion: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetInstanceView_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_GetInstanceView_virtualMachineScaleSetsGetInstanceViewMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().GetInstanceView(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetInstanceView = armcompute.VirtualMachineScaleSetInstanceView{ - // OrchestrationServices: []*armcompute.OrchestrationServiceSummary{ - // { - // ServiceName: to.Ptr(armcompute.OrchestrationServiceNamesAutomaticRepairs), - // ServiceState: to.Ptr(armcompute.OrchestrationServiceStateNotRunning), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.526Z"); return t}()), - // }}, - // VirtualMachine: &armcompute.VirtualMachineScaleSetInstanceViewStatusesSummary{ - // StatusesSummary: []*armcompute.VirtualMachineStatusCodeCount{ - // { - // Code: to.Ptr("aa"), - // Count: to.Ptr[int32](21), - // }}, - // }, - // Extensions: []*armcompute.VirtualMachineScaleSetVMExtensionsSummary{ - // { - // Name: to.Ptr("aaaaaaaaaaa"), - // StatusesSummary: []*armcompute.VirtualMachineStatusCodeCount{ - // { - // Code: to.Ptr("aa"), - // Count: to.Ptr[int32](21), - // }}, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetInstanceView_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_GetInstanceView_virtualMachineScaleSetsGetInstanceViewMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().GetInstanceView(ctx, "rgcompute", "aaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetInstanceView = armcompute.VirtualMachineScaleSetInstanceView{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListPager_virtualMachineScaleSetsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListResult = armcompute.VirtualMachineScaleSetListResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesDefault)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // DisableAutomaticRollback: to.Ptr(true), - // EnableAutomaticOSUpgrade: to.Ptr(true), - // UseRollingUpgradePolicy: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // RollbackFailedInstancesOnPolicyBreach: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](4), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aa"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aaaaaaaaaaaaaa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // ID: to.Ptr("aa"), - // Name: to.Ptr("myNic"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaa"), - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerInboundNatPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - // DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](18), - // IPTags: []*armcompute.VirtualMachineScaleSetIPTag{ - // { - // IPTagType: to.Ptr("aaaaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("aaa"), - // KeyData: to.Ptr("aaaaaa"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // { - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VaultCertificates: []*armcompute.VaultCertificate{ - // { - // CertificateStore: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // CertificateURL: to.Ptr("aaaaaaa"), - // }}, - // }}, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("aa"), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaa"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](30), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaa")}, - // }, - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesDefault)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // DisableAutomaticRollback: to.Ptr(true), - // EnableAutomaticOSUpgrade: to.Ptr(true), - // UseRollingUpgradePolicy: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeAutomatic), - // RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](4), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aa"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aaaaaaaaaaaaaa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("myNic1"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("myIPConfig"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerInboundNatPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - // DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](18), - // IPTags: []*armcompute.VirtualMachineScaleSetIPTag{ - // { - // IPTagType: to.Ptr("aaaaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNetworkSecurityGroup"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("admin"), - // ComputerNamePrefix: to.Ptr("{virtualMachineScaleSetName}"), - // CustomData: to.Ptr("a"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("aaa"), - // KeyData: to.Ptr("aaaaaa"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // { - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VaultCertificates: []*armcompute.VaultCertificate{ - // { - // CertificateStore: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // CertificateURL: to.Ptr("aaaaaaa"), - // }}, - // }}, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("aa"), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // }, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaa"), - // ExactVersion: to.Ptr("aa"), - // Offer: to.Ptr("databricks"), - // Publisher: to.Ptr("azuredatabricks"), - // SharedGalleryImageID: to.Ptr("aaaaaaa"), - // SKU: to.Ptr("databricksworker"), - // Version: to.Ptr("3.15.2"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("a"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](30), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesPremiumLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D2s_v3"), - // Capacity: to.Ptr[int64](4), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListPager_virtualMachineScaleSetsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListPager("rgcompute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListResult = armcompute.VirtualMachineScaleSetListResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Location: to.Ptr("eastus"), - // }, - // { - // Location: to.Ptr("eastus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListAllPager_virtualMachineScaleSetsListAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListWithLinkResult = armcompute.VirtualMachineScaleSetListWithLinkResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Name: to.Ptr("{virtualMachineScaleSetName}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key8425": to.Ptr("aaa"), - // }, - // ExtendedLocation: &armcompute.ExtendedLocation{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - // Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone), - // }, - // Identity: &armcompute.VirtualMachineScaleSetIdentity{ - // Type: to.Ptr(armcompute.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), - // TenantID: to.Ptr("aaaaaaaaaaaaaaaa"), - // UserAssignedIdentities: map[string]*armcompute.UserAssignedIdentitiesValue{ - // "key3951": &armcompute.UserAssignedIdentitiesValue{ - // ClientID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // PrincipalID: to.Ptr("aaaa"), - // }, - // }, - // }, - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AutomaticRepairsPolicy: &armcompute.AutomaticRepairsPolicy{ - // Enabled: to.Ptr(true), - // GracePeriod: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // DoNotRunExtensionsOnOverprovisionedVMs: to.Ptr(true), - // HostGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform), - // Overprovision: to.Ptr(true), - // PlatformFaultDomainCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr("Succeeded"), - // ProximityPlacementGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // ScaleInPolicy: &armcompute.ScaleInPolicy{ - // ForceDeletion: to.Ptr(true), - // Rules: []*armcompute.VirtualMachineScaleSetScaleInRules{ - // to.Ptr(armcompute.VirtualMachineScaleSetScaleInRulesDefault)}, - // }, - // SinglePlacementGroup: to.Ptr(true), - // SpotRestorePolicy: &armcompute.SpotRestorePolicy{ - // Enabled: to.Ptr(true), - // RestoreTimeout: to.Ptr("aaaaaaaaaa"), - // }, - // UniqueID: to.Ptr("aaaaaaaa"), - // UpgradePolicy: &armcompute.UpgradePolicy{ - // AutomaticOSUpgradePolicy: &armcompute.AutomaticOSUpgradePolicy{ - // DisableAutomaticRollback: to.Ptr(true), - // EnableAutomaticOSUpgrade: to.Ptr(true), - // }, - // Mode: to.Ptr(armcompute.UpgradeModeManual), - // RollingUpgradePolicy: &armcompute.RollingUpgradePolicy{ - // EnableCrossZoneUpgrade: to.Ptr(true), - // MaxBatchInstancePercent: to.Ptr[int32](49), - // MaxSurge: to.Ptr(true), - // MaxUnhealthyInstancePercent: to.Ptr[int32](81), - // MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](98), - // PauseTimeBetweenBatches: to.Ptr("aaaaaaaaaaaaaaa"), - // PrioritizeUnhealthyInstances: to.Ptr(true), - // RollbackFailedInstancesOnPolicyBreach: to.Ptr(true), - // }, - // }, - // VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ - // ApplicationProfile: &armcompute.ApplicationProfile{ - // GalleryApplications: []*armcompute.VMGalleryApplication{ - // { - // ConfigurationReference: to.Ptr("aaaaa"), - // Order: to.Ptr[int32](29), - // PackageReferenceID: to.Ptr("aaaaaaaaaa"), - // Tags: to.Ptr("aaaaaaaaaaa"), - // }}, - // }, - // BillingProfile: &armcompute.BillingProfile{ - // MaxPrice: to.Ptr[float64](4), - // }, - // CapacityReservation: &armcompute.CapacityReservationProfile{ - // CapacityReservationGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // }, - // }, - // EvictionPolicy: to.Ptr(armcompute.VirtualMachineEvictionPolicyTypesDeallocate), - // ExtensionProfile: &armcompute.VirtualMachineScaleSetExtensionProfile{ - // ExtensionsTimeBudget: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Extensions: []*armcompute.VirtualMachineScaleSetExtension{ - // { - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Name: to.Ptr("aa"), - // Type: to.Ptr("aaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetExtensionProperties{ - // Type: to.Ptr("aaaaaaaa"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // ProtectedSettings: map[string]any{ - // }, - // ProvisionAfterExtensions: []*string{ - // to.Ptr("aaaaaaaaaaaaaa")}, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("aaaaaaaaaaaaa"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // }}, - // }, - // LicenseType: to.Ptr("aaaaaaaaaa"), - // NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{ - // HealthProbe: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/rpcName/restorePoints/restorePointName/diskRestorePoints/testingexcludedisk_OsDisk_1_74cdaedcea50483d9833c96adefa100f_22b4bdfe-6c54-4f72-84d8-85d8860f0c57"), - // }, - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaa"), - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // to.Ptr("aaaaaaaaaaaa")}, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaaaaaa"), - // Name: to.Ptr("{vmss-name}"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerInboundNatPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - // DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](18), - // IPTags: []*armcompute.VirtualMachineScaleSetIPTag{ - // { - // IPTagType: to.Ptr("aaaaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.VirtualMachineScaleSetOSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // ComputerNamePrefix: to.Ptr("{vmss-name}"), - // CustomData: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("aaa"), - // KeyData: to.Ptr("aaaaaa"), - // }}, - // }, - // }, - // Secrets: []*armcompute.VaultSecretGroup{ - // { - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // VaultCertificates: []*armcompute.VaultCertificate{ - // { - // CertificateStore: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // CertificateURL: to.Ptr("aaaaaaa"), - // }}, - // }}, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // Priority: to.Ptr(armcompute.VirtualMachinePriorityTypesRegular), - // ScheduledEventsProfile: &armcompute.ScheduledEventsProfile{ - // TerminateNotificationProfile: &armcompute.TerminateNotificationProfile{ - // Enable: to.Ptr(true), - // NotBeforeTimeout: to.Ptr("aa"), - // }, - // }, - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ - // DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskIOPSReadWrite: to.Ptr[int64](11), - // DiskMBpsReadWrite: to.Ptr[int64](13), - // DiskSizeGB: to.Ptr[int32](11), - // Lun: to.Ptr[int32](24), - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // WriteAcceleratorEnabled: to.Ptr(true), - // }}, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("a"), - // ExactVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // OSDisk: &armcompute.VirtualMachineScaleSetOSDisk{ - // Name: to.Ptr("aaaaaaaaaaaaaaa"), - // Caching: to.Ptr(armcompute.CachingTypesReadWrite), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](30), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.VirtualMachineScaleSetManagedDiskParameters{ - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // VhdContainers: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("aaa"), - // }, - // ZoneBalance: to.Ptr(true), - // }, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Standard_D1_v2"), - // Capacity: to.Ptr[int64](3), - // Tier: to.Ptr("Standard"), - // }, - // Zones: []*string{ - // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListAllPager_virtualMachineScaleSetsListAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListWithLinkResult = armcompute.VirtualMachineScaleSetListWithLinkResult{ - // Value: []*armcompute.VirtualMachineScaleSet{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListSkus_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListSKUsPager_virtualMachineScaleSetsListSkusMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListSKUsPager("rgcompute", "aaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListSKUsResult = armcompute.VirtualMachineScaleSetListSKUsResult{ - // Value: []*armcompute.VirtualMachineScaleSetSKU{ - // { - // Capacity: &armcompute.VirtualMachineScaleSetSKUCapacity{ - // DefaultCapacity: to.Ptr[int64](20), - // Maximum: to.Ptr[int64](27), - // Minimum: to.Ptr[int64](22), - // ScaleType: to.Ptr(armcompute.VirtualMachineScaleSetSKUScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("aaaaaaaaaaaaaaaaa"), - // SKU: &armcompute.SKU{ - // Name: to.Ptr("DSv3-Type1"), - // Capacity: to.Ptr[int64](7), - // Tier: to.Ptr("aaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ListSkus_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewListSKUsPager_virtualMachineScaleSetsListSkusMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewListSKUsPager("rgcompute", "aaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListSKUsResult = armcompute.VirtualMachineScaleSetListSKUsResult{ - // Value: []*armcompute.VirtualMachineScaleSetSKU{ - // { - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetOSUpgradeHistory_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewGetOSUpgradeHistoryPager_virtualMachineScaleSetsGetOsUpgradeHistoryMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewGetOSUpgradeHistoryPager("rgcompute", "aaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListOSUpgradeHistory = armcompute.VirtualMachineScaleSetListOSUpgradeHistory{ - // Value: []*armcompute.UpgradeOperationHistoricalStatusInfo{ - // { - // Type: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaa"), - // Properties: &armcompute.UpgradeOperationHistoricalStatusInfoProperties{ - // Error: &armcompute.APIError{ - // Code: to.Ptr("aaaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaaaaaaaa"), - // Target: to.Ptr("aaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aa"), - // Target: to.Ptr("aaaa"), - // }}, - // }, - // Progress: &armcompute.RollingUpgradeProgressInfo{ - // FailedInstanceCount: to.Ptr[int32](25), - // InProgressInstanceCount: to.Ptr[int32](20), - // PendingInstanceCount: to.Ptr[int32](27), - // SuccessfulInstanceCount: to.Ptr[int32](6), - // }, - // RollbackInfo: &armcompute.RollbackStatusInfo{ - // FailedRolledbackInstanceCount: to.Ptr[int32](2), - // RollbackError: &armcompute.APIError{ - // Code: to.Ptr("aaaaaaa"), - // Innererror: &armcompute.InnerError{ - // Errordetail: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Exceptiontype: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Message: to.Ptr("aaaaaaaaa"), - // Target: to.Ptr("aaaaaaa"), - // Details: []*armcompute.APIErrorBase{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), - // Message: to.Ptr("aa"), - // Target: to.Ptr("aaaa"), - // }}, - // }, - // SuccessfullyRolledbackInstanceCount: to.Ptr[int32](12), - // }, - // RunningStatus: &armcompute.UpgradeOperationHistoryStatus{ - // Code: to.Ptr(armcompute.UpgradeStateRollingForward), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:05:40.443Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T13:05:40.442Z"); return t}()), - // }, - // StartedBy: to.Ptr(armcompute.UpgradeOperationInvokerUnknown), - // TargetImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), - // ExactVersion: to.Ptr("aaaaaaa"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaa"), - // SKU: to.Ptr("2016-Datacenter"), - // Version: to.Ptr("latest"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_GetOSUpgradeHistory_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_NewGetOSUpgradeHistoryPager_virtualMachineScaleSetsGetOsUpgradeHistoryMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetsClient().NewGetOSUpgradeHistoryPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetListOSUpgradeHistory = armcompute.VirtualMachineScaleSetListOSUpgradeHistory{ - // Value: []*armcompute.UpgradeOperationHistoricalStatusInfo{ - // { - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPowerOff_virtualMachineScaleSetsPowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginPowerOffOptions{SkipShutdown: to.Ptr(true), - VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPowerOff_virtualMachineScaleSetsPowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginPowerOff(ctx, "rgcompute", "a", &armcompute.VirtualMachineScaleSetsClientBeginPowerOffOptions{SkipShutdown: nil, - VMInstanceIDs: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Restart_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRestart_virtualMachineScaleSetsRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginRestart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginRestartOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Restart_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRestart_virtualMachineScaleSetsRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginRestart(ctx, "rgcompute", "aaaa", &armcompute.VirtualMachineScaleSetsClientBeginRestartOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Start_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginStart_virtualMachineScaleSetsStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginStartOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Start_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginStart_virtualMachineScaleSetsStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginStartOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRedeploy_virtualMachineScaleSetsRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginRedeployOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginRedeploy_virtualMachineScaleSetsRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginRedeployOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPerformMaintenance_virtualMachineScaleSetsPerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginPerformMaintenance_virtualMachineScaleSetsPerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginPerformMaintenance(ctx, "rgcompute", "aa", &armcompute.VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_UpdateInstances_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdateInstances_virtualMachineScaleSetsUpdateInstancesMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginUpdateInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_UpdateInstances_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginUpdateInstances_virtualMachineScaleSetsUpdateInstancesMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginUpdateInstances(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Reimage_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimage_virtualMachineScaleSetsReimageMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginReimage(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageOptions{VMScaleSetReimageInput: &armcompute.VirtualMachineScaleSetReimageParameters{ - TempDisk: to.Ptr(true), - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_Reimage_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimage_virtualMachineScaleSetsReimageMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginReimage(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageOptions{VMScaleSetReimageInput: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ReimageAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimageAll_virtualMachineScaleSetsReimageAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageAllOptions{VMInstanceIDs: &armcompute.VirtualMachineScaleSetVMInstanceIDs{ - InstanceIDs: []*string{ - to.Ptr("aaaaaaaaaaaaaaaaa")}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ReimageAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginReimageAll_virtualMachineScaleSetsReimageAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetsClientBeginReimageAllOptions{VMInstanceIDs: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_virtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", 30, &armcompute.VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions{Zone: nil, - PlacementGroupID: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecoveryWalkResponse = armcompute.RecoveryWalkResponse{ - // NextPlatformUpdateDomain: to.Ptr[int32](7), - // WalkPerformed: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_virtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetsClient().ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, "rgcompute", "aaaaaaaaaaaa", 9, &armcompute.VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions{Zone: nil, - PlacementGroupID: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecoveryWalkResponse = armcompute.RecoveryWalkResponse{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ConvertToSinglePlacementGroup_virtualMachineScaleSetsConvertToSinglePlacementGroupMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachineScaleSetsClient().ConvertToSinglePlacementGroup(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VMScaleSetConvertToSinglePlacementGroupInput{ - ActivePlacementGroupID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_ConvertToSinglePlacementGroup_virtualMachineScaleSetsConvertToSinglePlacementGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachineScaleSetsClient().ConvertToSinglePlacementGroup(ctx, "rgcompute", "aaaaaaaaaaaaa", armcompute.VMScaleSetConvertToSinglePlacementGroupInput{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_SetOrchestrationServiceState_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginSetOrchestrationServiceState_virtualMachineScaleSetsSetOrchestrationServiceStateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginSetOrchestrationServiceState(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", armcompute.OrchestrationServiceStateInput{ - Action: to.Ptr(armcompute.OrchestrationServiceStateActionResume), - ServiceName: to.Ptr(armcompute.OrchestrationServiceNamesAutomaticRepairs), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_SetOrchestrationServiceState_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetsClient_BeginSetOrchestrationServiceState_virtualMachineScaleSetsSetOrchestrationServiceStateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetsClient().BeginSetOrchestrationServiceState(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", armcompute.OrchestrationServiceStateInput{ - Action: to.Ptr(armcompute.OrchestrationServiceStateActionResume), - ServiceName: to.Ptr(armcompute.OrchestrationServiceNamesAutomaticRepairs), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go index fb02b3bea91b..ef2df765f66b 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) if err != nil { @@ -115,7 +115,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) @@ -124,7 +124,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -146,7 +146,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, options) if err != nil { @@ -190,7 +190,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) deleteCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,7 +199,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -252,7 +252,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) getCreateRequest(ctx con if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,7 +270,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -318,7 +318,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) listCreateRequest(ctx co if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -336,7 +336,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -359,7 +359,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) if err != nil { @@ -403,7 +403,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) updateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go deleted file mode 100644 index b4d639467411..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmextensions_client_example_test.go +++ /dev/null @@ -1,226 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_Create.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", armcompute.VirtualMachineScaleSetVMExtension{ - Properties: &armcompute.VirtualMachineExtensionProperties{ - Type: to.Ptr("extType"), - AutoUpgradeMinorVersion: to.Ptr(true), - Publisher: to.Ptr("extPublisher"), - Settings: map[string]any{ - "UserName": "xyz@microsoft.com", - }, - TypeHandlerVersion: to.Ptr("1.2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtension = armcompute.VirtualMachineScaleSetVMExtension{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_Update.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().BeginUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", armcompute.VirtualMachineScaleSetVMExtensionUpdate{ - Properties: &armcompute.VirtualMachineExtensionUpdateProperties{ - Type: to.Ptr("extType"), - AutoUpgradeMinorVersion: to.Ptr(true), - Publisher: to.Ptr("extPublisher"), - Settings: map[string]any{ - "UserName": "xyz@microsoft.com", - }, - TypeHandlerVersion: to.Ptr("1.2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtension = armcompute.VirtualMachineScaleSetVMExtension{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_Delete.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_Get.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myVMExtension", &armcompute.VirtualMachineScaleSetVMExtensionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtension = armcompute.VirtualMachineScaleSetVMExtension{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtensions_List.json -func ExampleVirtualMachineScaleSetVMExtensionsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMExtensionsClient().List(ctx, "myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMExtensionsClientListOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMExtensionsListResult = armcompute.VirtualMachineScaleSetVMExtensionsListResult{ - // Value: []*armcompute.VirtualMachineScaleSetVMExtension{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension"), - // Name: to.Ptr("myVMExtension"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.2"), - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/extensions/myVMExtension1"), - // Name: to.Ptr("myVMExtension1"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/extensions"), - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("extType1"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("extPublisher1"), - // Settings: map[string]any{ - // "UserName": "xyz@microsoft.com", - // }, - // TypeHandlerVersion: to.Ptr("1.0"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go index 67642752097e..afc01746974e 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client.go @@ -48,7 +48,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 2022-11-01 +// Generated from API version 2023-03-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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) if err != nil { @@ -115,7 +115,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, runCommand) @@ -124,7 +124,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -146,7 +146,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, options) if err != nil { @@ -190,7 +190,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -199,7 +199,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -252,7 +252,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) getCreateRequest(ctx co if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -269,7 +269,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -330,7 +330,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) listCreateRequest(ctx c if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, nil @@ -348,7 +348,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -371,7 +371,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) if err != nil { @@ -415,7 +415,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) updateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, runCommand) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go deleted file mode 100644 index 05d60c523af0..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvmruncommands_client_example_test.go +++ /dev/null @@ -1,266 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.json -func ExampleVirtualMachineScaleSetVMRunCommandsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", armcompute.VirtualMachineRunCommand{ - Location: to.Ptr("West US"), - Properties: &armcompute.VirtualMachineRunCommandProperties{ - AsyncExecution: to.Ptr(false), - Parameters: []*armcompute.RunCommandInputParameter{ - { - Name: to.Ptr("param1"), - Value: to.Ptr("value1"), - }, - { - Name: to.Ptr("param2"), - Value: to.Ptr("value2"), - }}, - RunAsPassword: to.Ptr(""), - RunAsUser: to.Ptr("user1"), - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - Script: to.Ptr("Write-Host Hello World!"), - }, - TimeoutInSeconds: to.Ptr[int32](3600), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.json -func ExampleVirtualMachineScaleSetVMRunCommandsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().BeginUpdate(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", armcompute.VirtualMachineRunCommandUpdate{ - Properties: &armcompute.VirtualMachineRunCommandProperties{ - Source: &armcompute.VirtualMachineRunCommandScriptSource{ - Script: to.Ptr("Write-Host Script Source Updated!"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Script Source Updated!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.json -func ExampleVirtualMachineScaleSetVMRunCommandsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.json -func ExampleVirtualMachineScaleSetVMRunCommandsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().Get(ctx, "myResourceGroup", "myvmScaleSet", "0", "myRunCommand", &armcompute.VirtualMachineScaleSetVMRunCommandsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineRunCommand = armcompute.VirtualMachineRunCommand{ - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](3600), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.json -func ExampleVirtualMachineScaleSetVMRunCommandsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetVMRunCommandsClient().NewListPager("myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMRunCommandsClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineRunCommandsListResult = armcompute.VirtualMachineRunCommandsListResult{ - // Value: []*armcompute.VirtualMachineRunCommand{ - // { - // Name: to.Ptr("myRunCommand"), - // Type: to.Ptr("Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand"), - // Location: to.Ptr("westus"), - // Properties: &armcompute.VirtualMachineRunCommandProperties{ - // AsyncExecution: to.Ptr(false), - // Parameters: []*armcompute.RunCommandInputParameter{ - // { - // Name: to.Ptr("param1"), - // Value: to.Ptr("value1"), - // }, - // { - // Name: to.Ptr("param2"), - // Value: to.Ptr("value2"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // RunAsUser: to.Ptr("user1"), - // Source: &armcompute.VirtualMachineRunCommandScriptSource{ - // Script: to.Ptr("Write-Host Hello World!"), - // }, - // TimeoutInSeconds: to.Ptr[int32](0), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go index e6e52c0a42cd..5518ed54c676 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client.go @@ -51,7 +51,7 @@ func NewVirtualMachineScaleSetVMsClient(subscriptionID string, credential azcore // machine once it is deallocated. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 +74,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeallocateOptions) (*http.Response, error) { req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -114,7 +114,7 @@ func (client *VirtualMachineScaleSetVMsClient) deallocateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,7 +123,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -144,7 +144,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -187,7 +187,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", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -196,7 +196,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -244,7 +244,7 @@ func (client *VirtualMachineScaleSetVMsClient) getCreateRequest(ctx context.Cont if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +262,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -307,7 +307,7 @@ func (client *VirtualMachineScaleSetVMsClient) getInstanceViewCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -324,7 +324,7 @@ func (client *VirtualMachineScaleSetVMsClient) getInstanceViewHandleResponse(res // NewListPager - Gets a list of all virtual machines in a VM scale sets. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-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 @@ -386,7 +386,7 @@ func (client *VirtualMachineScaleSetVMsClient) listCreateRequest(ctx context.Con if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -404,7 +404,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -425,7 +425,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPerformMaintenanceOptions) (*http.Response, error) { req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -465,7 +465,7 @@ func (client *VirtualMachineScaleSetVMsClient) performMaintenanceCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -476,7 +476,7 @@ func (client *VirtualMachineScaleSetVMsClient) performMaintenanceCreateRequest(c // charges. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -499,7 +499,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginPowerOff(ctx context.Context // charges. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPowerOffOptions) (*http.Response, error) { req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -542,7 +542,7 @@ func (client *VirtualMachineScaleSetVMsClient) powerOffCreateRequest(ctx context if options != nil && options.SkipShutdown != nil { reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -552,7 +552,7 @@ func (client *VirtualMachineScaleSetVMsClient) powerOffCreateRequest(ctx context // back on. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -574,7 +574,7 @@ func (client *VirtualMachineScaleSetVMsClient) BeginRedeploy(ctx context.Context // on. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -614,7 +614,7 @@ func (client *VirtualMachineScaleSetVMsClient) redeployCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -623,7 +623,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -644,7 +644,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -684,7 +684,7 @@ func (client *VirtualMachineScaleSetVMsClient) reimageCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.VMScaleSetVMReimageInput != nil { @@ -697,7 +697,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -719,7 +719,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageAllOptions) (*http.Response, error) { req, err := client.reimageAllCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -759,7 +759,7 @@ func (client *VirtualMachineScaleSetVMsClient) reimageAllCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -768,7 +768,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -789,7 +789,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -829,7 +829,7 @@ func (client *VirtualMachineScaleSetVMsClient) restartCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -839,7 +839,7 @@ func (client *VirtualMachineScaleSetVMsClient) restartCreateRequest(ctx context. // scale set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -887,7 +887,7 @@ func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataCreate if options != nil && options.SasURIExpirationTimeInMinutes != nil { reqQP.Set("sasUriExpirationTimeInMinutes", strconv.FormatInt(int64(*options.SasURIExpirationTimeInMinutes), 10)) } - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -905,7 +905,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -929,7 +929,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) runCommand(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsClientBeginRunCommandOptions) (*http.Response, error) { req, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) if err != nil { @@ -969,7 +969,7 @@ func (client *VirtualMachineScaleSetVMsClient) runCommandCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json, text/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -978,7 +978,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -1023,7 +1023,7 @@ func (client *VirtualMachineScaleSetVMsClient) simulateEvictionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1032,7 +1032,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 2022-11-01 +// Generated from API version 2023-03-01 // - resourceGroupName - The name of the resource group. // - vmScaleSetName - The name of the VM scale set. // - instanceID - The instance ID of the virtual machine. @@ -1053,7 +1053,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { @@ -1093,7 +1093,7 @@ func (client *VirtualMachineScaleSetVMsClient) startCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1102,7 +1102,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 2022-11-01 +// Generated from API version 2023-03-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. @@ -1124,7 +1124,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 2022-11-01 +// Generated from API version 2023-03-01 func (client *VirtualMachineScaleSetVMsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) if err != nil { @@ -1164,7 +1164,7 @@ func (client *VirtualMachineScaleSetVMsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go b/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go deleted file mode 100644 index 69edd8ece354..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinescalesetvms_client_example_test.go +++ /dev/null @@ -1,2362 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Reimage_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVMsReimageMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginReimage(ctx, "rgcompute", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginReimageOptions{VMScaleSetVMReimageInput: &armcompute.VirtualMachineScaleSetVMReimageParameters{ - TempDisk: to.Ptr(true), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Reimage_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimage_virtualMachineScaleSetVMsReimageMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginReimage(ctx, "rgcompute", "aaaaaaa", "aaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginReimageOptions{VMScaleSetVMReimageInput: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_ReimageAll_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimageAll_virtualMachineScaleSetVMsReimageAllMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_ReimageAll_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginReimageAll_virtualMachineScaleSetVMsReimageAllMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginReimageAll(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Deallocate_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginDeallocate_virtualMachineScaleSetVMsDeallocateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Deallocate_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginDeallocate_virtualMachineScaleSetVMsDeallocateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginDeallocate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Update_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginUpdate_virtualMachineScaleSetVMsUpdateMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVM{ - Location: to.Ptr("westus"), - Tags: map[string]*string{}, - Plan: &armcompute.Plan{ - Name: to.Ptr("aaaaaaaaaa"), - Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - }, - Properties: &armcompute.VirtualMachineScaleSetVMProperties{ - AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - HibernationEnabled: to.Ptr(true), - UltraSSDEnabled: to.Ptr(true), - }, - AvailabilitySet: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - BootDiagnostics: &armcompute.BootDiagnostics{ - Enabled: to.Ptr(true), - StorageURI: to.Ptr("aaaaaaaaaaaaa"), - }, - }, - HardwareProfile: &armcompute.HardwareProfile{ - VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesBasicA0), - VMSizeProperties: &armcompute.VMSizeProperties{ - VCPUsAvailable: to.Ptr[int32](9), - VCPUsPerCore: to.Ptr[int32](12), - }, - }, - InstanceView: &armcompute.VirtualMachineScaleSetVMInstanceView{ - BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - Status: &armcompute.InstanceViewStatus{ - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }, - }, - Disks: []*armcompute.DiskInstanceView{ - { - Name: to.Ptr("aaaaaaaaaaa"), - EncryptionSettings: []*armcompute.DiskEncryptionSettings{ - { - DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - SecretURL: to.Ptr("aaaaaaaa"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - Enabled: to.Ptr(true), - KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - KeyURL: to.Ptr("aaaaaaaaaaaaaa"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - }}, - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - }}, - MaintenanceRedeployStatus: &armcompute.MaintenanceRedeployStatus{ - IsCustomerInitiatedMaintenanceAllowed: to.Ptr(true), - LastOperationMessage: to.Ptr("aaaaaa"), - LastOperationResultCode: to.Ptr(armcompute.MaintenanceOperationResultCodeTypesNone), - MaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()), - MaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()), - PreMaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()), - PreMaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t }()), - }, - PlacementGroupID: to.Ptr("aaa"), - PlatformFaultDomain: to.Ptr[int32](14), - PlatformUpdateDomain: to.Ptr[int32](23), - RdpThumbPrint: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - { - Type: to.Ptr("aaaaaaaaaaaaa"), - Status: &armcompute.InstanceViewStatus{ - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }, - TypeHandlerVersion: to.Ptr("aaaaa"), - }}, - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - VMAgentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - }, - VMHealth: &armcompute.VirtualMachineHealthStatus{ - Status: &armcompute.InstanceViewStatus{ - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }, - }, - Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - { - Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - Type: to.Ptr("aaaaaaaaa"), - Statuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - Substatuses: []*armcompute.InstanceViewStatus{ - { - Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - DisplayStatus: to.Ptr("aaaaaa"), - Level: to.Ptr(armcompute.StatusLevelTypesInfo), - Message: to.Ptr("a"), - Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t }()), - }}, - TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - }}, - }, - LicenseType: to.Ptr("aaaaaaaaaa"), - NetworkProfile: &armcompute.NetworkProfile{ - NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - { - Name: to.Ptr("aaaaaaaaaaa"), - Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - DNSServers: []*string{ - to.Ptr("aaaaaa")}, - }, - DscpConfiguration: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - EnableAcceleratedNetworking: to.Ptr(true), - EnableFpga: to.Ptr(true), - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{ - { - Name: to.Ptr("aa"), - Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{ - ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - ApplicationSecurityGroups: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - Primary: to.Ptr(true), - PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{ - Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - }, - IdleTimeoutInMinutes: to.Ptr[int32](2), - IPTags: []*armcompute.VirtualMachineIPTag{ - { - IPTagType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - }}, - PublicIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodDynamic), - PublicIPPrefix: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - SKU: &armcompute.PublicIPAddressSKU{ - Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - }, - }, - Subnet: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - }}, - NetworkSecurityGroup: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - Primary: to.Ptr(true), - }, - }}, - NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - { - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"), - Properties: &armcompute.NetworkInterfaceReferenceProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - Primary: to.Ptr(true), - }, - }}, - }, - NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{ - NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - { - ID: to.Ptr("aaaaaaaa"), - Name: to.Ptr("vmsstestnetconfig5415"), - Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - DNSServers: []*string{}, - }, - EnableAcceleratedNetworking: to.Ptr(true), - EnableFpga: to.Ptr(true), - EnableIPForwarding: to.Ptr(true), - IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - { - ID: to.Ptr("aaaaaaaaa"), - Name: to.Ptr("vmsstestnetconfig9693"), - Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - ApplicationSecurityGroups: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - LoadBalancerInboundNatPools: []*armcompute.SubResource{ - { - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }}, - Primary: to.Ptr(true), - PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - }, - IdleTimeoutInMinutes: to.Ptr[int32](18), - IPTags: []*armcompute.VirtualMachineScaleSetIPTag{ - { - IPTagType: to.Ptr("aaaaaaa"), - Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - }}, - PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - PublicIPPrefix: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - SKU: &armcompute.PublicIPAddressSKU{ - Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - }, - }, - Subnet: &armcompute.APIEntityReference{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"), - }, - }, - }}, - NetworkSecurityGroup: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - Primary: to.Ptr(true), - }, - }}, - }, - OSProfile: &armcompute.OSProfile{ - AdminPassword: to.Ptr("aaaaaaaaaaaaaaaa"), - AdminUsername: to.Ptr("Foo12"), - AllowExtensionOperations: to.Ptr(true), - ComputerName: to.Ptr("test000000"), - CustomData: to.Ptr("aaaa"), - LinuxConfiguration: &armcompute.LinuxConfiguration{ - DisablePasswordAuthentication: to.Ptr(true), - PatchSettings: &armcompute.LinuxPatchSettings{ - AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - }, - ProvisionVMAgent: to.Ptr(true), - SSH: &armcompute.SSHConfiguration{ - PublicKeys: []*armcompute.SSHPublicKey{ - { - Path: to.Ptr("aaa"), - KeyData: to.Ptr("aaaaaa"), - }}, - }, - }, - RequireGuestProvisionSignal: to.Ptr(true), - Secrets: []*armcompute.VaultSecretGroup{}, - WindowsConfiguration: &armcompute.WindowsConfiguration{ - AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - { - ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - PassName: to.Ptr("OobeSystem"), - SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - }}, - EnableAutomaticUpdates: to.Ptr(true), - PatchSettings: &armcompute.PatchSettings{ - AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - EnableHotpatching: to.Ptr(true), - PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - }, - ProvisionVMAgent: to.Ptr(true), - TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - WinRM: &armcompute.WinRMConfiguration{ - Listeners: []*armcompute.WinRMListener{ - { - CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - }}, - }, - }, - }, - ProtectionPolicy: &armcompute.VirtualMachineScaleSetVMProtectionPolicy{ - ProtectFromScaleIn: to.Ptr(true), - ProtectFromScaleSetActions: to.Ptr(true), - }, - SecurityProfile: &armcompute.SecurityProfile{ - EncryptionAtHost: to.Ptr(true), - SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - UefiSettings: &armcompute.UefiSettings{ - SecureBootEnabled: to.Ptr(true), - VTpmEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armcompute.StorageProfile{ - DataDisks: []*armcompute.DataDisk{ - { - Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - Caching: to.Ptr(armcompute.CachingTypesNone), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - DiskSizeGB: to.Ptr[int32](128), - Image: &armcompute.VirtualHardDisk{ - URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - }, - Lun: to.Ptr[int32](1), - ManagedDisk: &armcompute.ManagedDiskParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("aaaaaaaaaaaa"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - ToBeDetached: to.Ptr(true), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - }, - WriteAcceleratorEnabled: to.Ptr(true), - }}, - ImageReference: &armcompute.ImageReference{ - ID: to.Ptr("a"), - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("MicrosoftWindowsServer"), - SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - SKU: to.Ptr("2012-R2-Datacenter"), - Version: to.Ptr("4.127.20180315"), - }, - OSDisk: &armcompute.OSDisk{ - Name: to.Ptr("vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - Caching: to.Ptr(armcompute.CachingTypesNone), - CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - DiffDiskSettings: &armcompute.DiffDiskSettings{ - Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - }, - DiskSizeGB: to.Ptr[int32](127), - EncryptionSettings: &armcompute.DiskEncryptionSettings{ - DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - SecretURL: to.Ptr("aaaaaaaa"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - Enabled: to.Ptr(true), - KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - KeyURL: to.Ptr("aaaaaaaaaaaaaa"), - SourceVault: &armcompute.SubResource{ - ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - }, - }, - }, - Image: &armcompute.VirtualHardDisk{ - URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - }, - ManagedDisk: &armcompute.ManagedDiskParameters{ - ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - ID: to.Ptr("aaaaaaaaaaaa"), - }, - StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - }, - OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - Vhd: &armcompute.VirtualHardDisk{ - URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - }, - WriteAcceleratorEnabled: to.Ptr(true), - }, - }, - UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - }, - SKU: &armcompute.SKU{ - Name: to.Ptr("Classic"), - Capacity: to.Ptr[int64](29), - Tier: to.Ptr("aaaaaaaaaaaaaa"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // InstanceID: to.Ptr("aaaaaaaaaaaa"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetVMProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaa"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesBasicA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](9), - // VCPUsPerCore: to.Ptr[int32](12), - // }, - // }, - // InstanceView: &armcompute.VirtualMachineScaleSetVMInstanceView{ - // AssignedHost: to.Ptr("aaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }, - // }, - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("aaaaaaaaaaa"), - // EncryptionSettings: []*armcompute.DiskEncryptionSettings{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // }}, - // MaintenanceRedeployStatus: &armcompute.MaintenanceRedeployStatus{ - // IsCustomerInitiatedMaintenanceAllowed: to.Ptr(true), - // LastOperationMessage: to.Ptr("aaaaaa"), - // LastOperationResultCode: to.Ptr(armcompute.MaintenanceOperationResultCodeTypesNone), - // MaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t}()), - // MaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t}()), - // PreMaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t}()), - // PreMaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t}()), - // }, - // PlacementGroupID: to.Ptr("aaa"), - // PlatformFaultDomain: to.Ptr[int32](14), - // PlatformUpdateDomain: to.Ptr[int32](23), - // RdpThumbPrint: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - // { - // Type: to.Ptr("aaaaaaaaaaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("aaaaa"), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // VMHealth: &armcompute.VirtualMachineHealthStatus{ - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }, - // }, - // Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // LatestModelApplied: to.Ptr(true), - // LicenseType: to.Ptr("aaaaaaaaaa"), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaa")}, - // }, - // DscpConfiguration: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{ - // { - // Name: to.Ptr("aa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](2), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodDynamic), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("vmsstestnetconfig5415"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaa"), - // Name: to.Ptr("vmsstestnetconfig9693"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerInboundNatPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - // DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](18), - // IPTags: []*armcompute.VirtualMachineScaleSetIPTag{ - // { - // IPTagType: to.Ptr("aaaaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("test000000"), - // CustomData: to.Ptr("aaaa"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("aaa"), - // KeyData: to.Ptr("aaaaaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // ProtectionPolicy: &armcompute.VirtualMachineScaleSetVMProtectionPolicy{ - // ProtectFromScaleIn: to.Ptr(true), - // ProtectFromScaleSetActions: to.Ptr(true), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - // DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - // DiskIOPSReadWrite: to.Ptr[int64](18), - // DiskMBpsReadWrite: to.Ptr[int64](29), - // DiskSizeGB: to.Ptr[int32](128), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(true), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // WriteAcceleratorEnabled: to.Ptr(true), - // }}, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("a"), - // ExactVersion: to.Ptr("4.127.20180315"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20180315"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](127), - // EncryptionSettings: &armcompute.DiskEncryptionSettings{ - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }, - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // Zones: []*string{ - // to.Ptr("a")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Update_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginUpdate_virtualMachineScaleSetVMsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginUpdate(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", armcompute.VirtualMachineScaleSetVM{ - Location: to.Ptr("westus"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Location: to.Ptr("westus"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.json -func ExampleVirtualMachineScaleSetVMsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginDelete(ctx, "myResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMsClientBeginDeleteOptions{ForceDeletion: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.json -func ExampleVirtualMachineScaleSetVMsClient_Get_getVmScaleSetVmWithUserData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().Get(ctx, "myResourceGroup", "{vmss-name}", "0", &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetVMProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // }, - // LatestModelApplied: to.Ptr(true), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"), - // }}, - // }, - // NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig5415"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig9693"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("test000000"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](128), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(false), - // }}, - // ImageReference: &armcompute.ImageReference{ - // ExactVersion: to.Ptr("4.127.20180315"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20180315"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](127), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.json -func ExampleVirtualMachineScaleSetVMsClient_Get_getVmScaleSetVmWithVmSizeProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().Get(ctx, "myResourceGroup", "{vmss-name}", "0", &armcompute.VirtualMachineScaleSetVMsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVM = armcompute.VirtualMachineScaleSetVM{ - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "myTag1": to.Ptr("tagValue1"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetVMProperties{ - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](1), - // VCPUsPerCore: to.Ptr[int32](1), - // }, - // }, - // LatestModelApplied: to.Ptr(true), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"), - // }}, - // }, - // NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig5415"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(false), - // EnableIPForwarding: to.Ptr(false), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // Name: to.Ptr("vmsstestnetconfig9693"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"), - // }, - // }, - // }}, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("test000000"), - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // EnableAutomaticUpdates: to.Ptr(true), - // ProvisionVMAgent: to.Ptr(true), - // }, - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DiskSizeGB: to.Ptr[int32](128), - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(false), - // }}, - // ImageReference: &armcompute.ImageReference{ - // ExactVersion: to.Ptr("4.127.20180315"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20180315"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DiskSizeGB: to.Ptr[int32](127), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "displayName": to.Ptr("CustomScriptExtension-DSC"), - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json -func ExampleVirtualMachineScaleSetVMsClient_GetInstanceView() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().GetInstanceView(ctx, "myResourceGroup", "myVirtualMachineScaleSet", "0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineScaleSetVMInstanceView = armcompute.VirtualMachineScaleSetVMInstanceView{ - // AssignedHost: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup/hosts/myHost"), - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("myOSDisk"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T04:58:58.0882815+00:00"); return t}()), - // }}, - // }}, - // PlatformFaultDomain: to.Ptr[int32](0), - // PlatformUpdateDomain: to.Ptr[int32](0), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-05T04:59:58.1852966+00:00"); return t}()), - // }, - // { - // Code: to.Ptr("PowerState/running"), - // DisplayStatus: to.Ptr("VM running"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ProvisioningState/Unavailable"), - // DisplayStatus: to.Ptr("Not Ready"), - // Level: to.Ptr(armcompute.StatusLevelTypesWarning), - // Message: to.Ptr("VM status blob is found but not yet populated."), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T05:00:32+00:00"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("Unknown"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_List_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_NewListPager_virtualMachineScaleSetVMsListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetVMsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: to.Ptr("aaaaaaaaaaaaaa"), - Select: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), - Expand: to.Ptr("aaaaaaaaaaaaa"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetVMListResult = armcompute.VirtualMachineScaleSetVMListResult{ - // Value: []*armcompute.VirtualMachineScaleSetVM{ - // { - // Name: to.Ptr("{vmss-vm-name}"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // InstanceID: to.Ptr("aaaaaaaaaaaa"), - // Plan: &armcompute.Plan{ - // Name: to.Ptr("aaaaaaaaaa"), - // Product: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PromotionCode: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // Publisher: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // }, - // Properties: &armcompute.VirtualMachineScaleSetVMProperties{ - // AdditionalCapabilities: &armcompute.AdditionalCapabilities{ - // HibernationEnabled: to.Ptr(true), - // UltraSSDEnabled: to.Ptr(true), - // }, - // AvailabilitySet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // DiagnosticsProfile: &armcompute.DiagnosticsProfile{ - // BootDiagnostics: &armcompute.BootDiagnostics{ - // Enabled: to.Ptr(true), - // StorageURI: to.Ptr("aaaaaaaaaaaaa"), - // }, - // }, - // HardwareProfile: &armcompute.HardwareProfile{ - // VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesBasicA0), - // VMSizeProperties: &armcompute.VMSizeProperties{ - // VCPUsAvailable: to.Ptr[int32](9), - // VCPUsPerCore: to.Ptr[int32](12), - // }, - // }, - // InstanceView: &armcompute.VirtualMachineScaleSetVMInstanceView{ - // AssignedHost: to.Ptr("aaaaaaa"), - // BootDiagnostics: &armcompute.BootDiagnosticsInstanceView{ - // ConsoleScreenshotBlobURI: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // SerialConsoleLogBlobURI: to.Ptr("aaaaaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }, - // }, - // Disks: []*armcompute.DiskInstanceView{ - // { - // Name: to.Ptr("aaaaaaaaaaa"), - // EncryptionSettings: []*armcompute.DiskEncryptionSettings{ - // { - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // }}, - // MaintenanceRedeployStatus: &armcompute.MaintenanceRedeployStatus{ - // IsCustomerInitiatedMaintenanceAllowed: to.Ptr(true), - // LastOperationMessage: to.Ptr("aaaaaa"), - // LastOperationResultCode: to.Ptr(armcompute.MaintenanceOperationResultCodeTypesNone), - // MaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t}()), - // MaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t}()), - // PreMaintenanceWindowEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t}()), - // PreMaintenanceWindowStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.531Z"); return t}()), - // }, - // PlacementGroupID: to.Ptr("aaa"), - // PlatformFaultDomain: to.Ptr[int32](14), - // PlatformUpdateDomain: to.Ptr[int32](23), - // RdpThumbPrint: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // VMAgent: &armcompute.VirtualMachineAgentInstanceView{ - // ExtensionHandlers: []*armcompute.VirtualMachineExtensionHandlerInstanceView{ - // { - // Type: to.Ptr("aaaaaaaaaaaaa"), - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("aaaaa"), - // }}, - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // VMAgentVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // VMHealth: &armcompute.VirtualMachineHealthStatus{ - // Status: &armcompute.InstanceViewStatus{ - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }, - // }, - // Extensions: []*armcompute.VirtualMachineExtensionInstanceView{ - // { - // Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // }, - // LatestModelApplied: to.Ptr(true), - // LicenseType: to.Ptr("aaaaaaaaaa"), - // ModelDefinitionApplied: to.Ptr("VirtualMachineScaleSet"), - // NetworkProfile: &armcompute.NetworkProfile{ - // NetworkAPIVersion: to.Ptr(armcompute.NetworkAPIVersionTwoThousandTwenty1101), - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineNetworkInterfaceConfiguration{ - // { - // Name: to.Ptr("aaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineNetworkInterfaceDNSSettingsConfiguration{ - // DNSServers: []*string{ - // to.Ptr("aaaaaa")}, - // }, - // DscpConfiguration: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineNetworkInterfaceIPConfiguration{ - // { - // Name: to.Ptr("aa"), - // Properties: &armcompute.VirtualMachineNetworkInterfaceIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachinePublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachinePublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachinePublicIPAddressDNSSettingsConfiguration{ - // DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](2), - // IPTags: []*armcompute.VirtualMachineIPTag{ - // { - // IPTagType: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionsIPv4), - // PublicIPAllocationMethod: to.Ptr(armcompute.PublicIPAllocationMethodDynamic), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ - // { - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415"), - // Properties: &armcompute.NetworkInterfaceReferenceProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // NetworkProfileConfiguration: &armcompute.VirtualMachineScaleSetVMNetworkProfileConfiguration{ - // NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{ - // { - // ID: to.Ptr("aaaaaaaa"), - // Name: to.Ptr("vmsstestnetconfig5415"), - // Properties: &armcompute.VirtualMachineScaleSetNetworkConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetNetworkConfigurationDNSSettings{ - // DNSServers: []*string{ - // }, - // }, - // EnableAcceleratedNetworking: to.Ptr(true), - // EnableFpga: to.Ptr(true), - // EnableIPForwarding: to.Ptr(true), - // IPConfigurations: []*armcompute.VirtualMachineScaleSetIPConfiguration{ - // { - // ID: to.Ptr("aaaaaaaaa"), - // Name: to.Ptr("vmsstestnetconfig9693"), - // Properties: &armcompute.VirtualMachineScaleSetIPConfigurationProperties{ - // ApplicationGatewayBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // ApplicationSecurityGroups: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerBackendAddressPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // LoadBalancerInboundNatPools: []*armcompute.SubResource{ - // { - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }}, - // Primary: to.Ptr(true), - // PrivateIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPAddressConfiguration: &armcompute.VirtualMachineScaleSetPublicIPAddressConfiguration{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // Properties: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{ - // DeleteOption: to.Ptr(armcompute.DeleteOptionsDelete), - // DNSSettings: &armcompute.VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings{ - // DomainNameLabel: to.Ptr("aaaaaaaaaaaaaaaaaa"), - // }, - // IdleTimeoutInMinutes: to.Ptr[int32](18), - // IPTags: []*armcompute.VirtualMachineScaleSetIPTag{ - // { - // IPTagType: to.Ptr("aaaaaaa"), - // Tag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }}, - // PublicIPAddressVersion: to.Ptr(armcompute.IPVersionIPv4), - // PublicIPPrefix: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // SKU: &armcompute.PublicIPAddressSKU{ - // Name: to.Ptr(armcompute.PublicIPAddressSKUNameBasic), - // Tier: to.Ptr(armcompute.PublicIPAddressSKUTierRegional), - // }, - // }, - // Subnet: &armcompute.APIEntityReference{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503"), - // }, - // }, - // }}, - // NetworkSecurityGroup: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // Primary: to.Ptr(true), - // }, - // }}, - // }, - // OSProfile: &armcompute.OSProfile{ - // AdminUsername: to.Ptr("Foo12"), - // AllowExtensionOperations: to.Ptr(true), - // ComputerName: to.Ptr("test000000"), - // CustomData: to.Ptr("aaaa"), - // LinuxConfiguration: &armcompute.LinuxConfiguration{ - // DisablePasswordAuthentication: to.Ptr(true), - // PatchSettings: &armcompute.LinuxPatchSettings{ - // AssessmentMode: to.Ptr(armcompute.LinuxPatchAssessmentModeImageDefault), - // PatchMode: to.Ptr(armcompute.LinuxVMGuestPatchModeImageDefault), - // }, - // ProvisionVMAgent: to.Ptr(true), - // SSH: &armcompute.SSHConfiguration{ - // PublicKeys: []*armcompute.SSHPublicKey{ - // { - // Path: to.Ptr("aaa"), - // KeyData: to.Ptr("aaaaaa"), - // }}, - // }, - // }, - // RequireGuestProvisionSignal: to.Ptr(true), - // Secrets: []*armcompute.VaultSecretGroup{ - // }, - // WindowsConfiguration: &armcompute.WindowsConfiguration{ - // AdditionalUnattendContent: []*armcompute.AdditionalUnattendContent{ - // { - // ComponentName: to.Ptr("Microsoft-Windows-Shell-Setup"), - // Content: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // PassName: to.Ptr("OobeSystem"), - // SettingName: to.Ptr(armcompute.SettingNamesAutoLogon), - // }}, - // EnableAutomaticUpdates: to.Ptr(true), - // PatchSettings: &armcompute.PatchSettings{ - // AssessmentMode: to.Ptr(armcompute.WindowsPatchAssessmentModeImageDefault), - // EnableHotpatching: to.Ptr(true), - // PatchMode: to.Ptr(armcompute.WindowsVMGuestPatchModeManual), - // }, - // ProvisionVMAgent: to.Ptr(true), - // TimeZone: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // WinRM: &armcompute.WinRMConfiguration{ - // Listeners: []*armcompute.WinRMListener{ - // { - // CertificateURL: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), - // Protocol: to.Ptr(armcompute.ProtocolTypesHTTP), - // }}, - // }, - // }, - // }, - // ProtectionPolicy: &armcompute.VirtualMachineScaleSetVMProtectionPolicy{ - // ProtectFromScaleIn: to.Ptr(true), - // ProtectFromScaleSetActions: to.Ptr(true), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // SecurityProfile: &armcompute.SecurityProfile{ - // EncryptionAtHost: to.Ptr(true), - // SecurityType: to.Ptr(armcompute.SecurityTypesTrustedLaunch), - // UefiSettings: &armcompute.UefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // VTpmEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armcompute.StorageProfile{ - // DataDisks: []*armcompute.DataDisk{ - // { - // Name: to.Ptr("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesEmpty), - // DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - // DetachOption: to.Ptr(armcompute.DiskDetachOptionTypesForceDetach), - // DiskIOPSReadWrite: to.Ptr[int64](18), - // DiskMBpsReadWrite: to.Ptr[int64](29), - // DiskSizeGB: to.Ptr[int32](128), - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // Lun: to.Ptr[int32](1), - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // ToBeDetached: to.Ptr(true), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // WriteAcceleratorEnabled: to.Ptr(true), - // }}, - // ImageReference: &armcompute.ImageReference{ - // ID: to.Ptr("a"), - // ExactVersion: to.Ptr("4.127.20180315"), - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("MicrosoftWindowsServer"), - // SharedGalleryImageID: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), - // SKU: to.Ptr("2012-R2-Datacenter"), - // Version: to.Ptr("4.127.20180315"), - // }, - // OSDisk: &armcompute.OSDisk{ - // Name: to.Ptr("vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // Caching: to.Ptr(armcompute.CachingTypesNone), - // CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), - // DeleteOption: to.Ptr(armcompute.DiskDeleteOptionTypesDelete), - // DiffDiskSettings: &armcompute.DiffDiskSettings{ - // Option: to.Ptr(armcompute.DiffDiskOptionsLocal), - // Placement: to.Ptr(armcompute.DiffDiskPlacementCacheDisk), - // }, - // DiskSizeGB: to.Ptr[int32](127), - // EncryptionSettings: &armcompute.DiskEncryptionSettings{ - // DiskEncryptionKey: &armcompute.KeyVaultSecretReference{ - // SecretURL: to.Ptr("aaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // Enabled: to.Ptr(true), - // KeyEncryptionKey: &armcompute.KeyVaultKeyReference{ - // KeyURL: to.Ptr("aaaaaaaaaaaaaa"), - // SourceVault: &armcompute.SubResource{ - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"), - // }, - // }, - // }, - // Image: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // ManagedDisk: &armcompute.ManagedDiskParameters{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc"), - // DiskEncryptionSet: &armcompute.DiskEncryptionSetParameters{ - // ID: to.Ptr("aaaaaaaaaaaa"), - // }, - // StorageAccountType: to.Ptr(armcompute.StorageAccountTypesStandardLRS), - // }, - // OSType: to.Ptr(armcompute.OperatingSystemTypesWindows), - // Vhd: &armcompute.VirtualHardDisk{ - // URI: to.Ptr("https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd"), - // }, - // WriteAcceleratorEnabled: to.Ptr(true), - // }, - // }, - // UserData: to.Ptr("RXhhbXBsZSBVc2VyRGF0YQ=="), - // VMID: to.Ptr("42af9fdf-b906-4ad7-9905-8316209ff619"), - // }, - // Resources: []*armcompute.VirtualMachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension-DSC"), - // Type: to.Ptr("Microsoft.Compute/virtualMachines/extensions"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armcompute.VirtualMachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(true), - // EnableAutomaticUpgrade: to.Ptr(true), - // ForceUpdateTag: to.Ptr("aaaaaaa"), - // InstanceView: &armcompute.VirtualMachineExtensionInstanceView{ - // Name: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Type: to.Ptr("aaaaaaaaa"), - // Statuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // Substatuses: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), - // DisplayStatus: to.Ptr("aaaaaa"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("a"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()), - // }}, - // TypeHandlerVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // }, - // SuppressFailures: to.Ptr(true), - // TypeHandlerVersion: to.Ptr("1.9"), - // }, - // }}, - // SKU: &armcompute.SKU{ - // Name: to.Ptr("Classic"), - // Capacity: to.Ptr[int64](29), - // Tier: to.Ptr("aaaaaaaaaaaaaa"), - // }, - // Zones: []*string{ - // to.Ptr("a")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_List_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_NewListPager_virtualMachineScaleSetVMsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineScaleSetVMsClient().NewListPager("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientListOptions{Filter: nil, - Select: nil, - Expand: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineScaleSetVMListResult = armcompute.VirtualMachineScaleSetVMListResult{ - // Value: []*armcompute.VirtualMachineScaleSetVM{ - // { - // Location: to.Ptr("westus"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PowerOff_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPowerOff_virtualMachineScaleSetVMsPowerOffMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginPowerOff(ctx, "rgcompute", "aaaaaa", "aaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginPowerOffOptions{SkipShutdown: to.Ptr(true)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PowerOff_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPowerOff_virtualMachineScaleSetVMsPowerOffMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginPowerOff(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa", &armcompute.VirtualMachineScaleSetVMsClientBeginPowerOffOptions{SkipShutdown: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Restart_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRestart_virtualMachineScaleSetVMsRestartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginRestart(ctx, "rgcompute", "aa", "aaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Restart_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRestart_virtualMachineScaleSetVMsRestartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginRestart(ctx, "rgcompute", "aaaaaaaaaaaa", "aaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Start_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginStart_virtualMachineScaleSetVMsStartMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Start_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginStart_virtualMachineScaleSetVMsStartMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginStart(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Redeploy_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRedeploy_virtualMachineScaleSetVMsRedeployMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_Redeploy_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRedeploy_virtualMachineScaleSetVMsRedeployMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginRedeploy(ctx, "rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.json -func ExampleVirtualMachineScaleSetVMsClient_RetrieveBootDiagnosticsData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineScaleSetVMsClient().RetrieveBootDiagnosticsData(ctx, "ResourceGroup", "myvmScaleSet", "0", &armcompute.VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions{SasURIExpirationTimeInMinutes: to.Ptr[int32](60)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RetrieveBootDiagnosticsDataResult = armcompute.RetrieveBootDiagnosticsDataResult{ - // ConsoleScreenshotBlobURI: to.Ptr("https://storageuri/myvmScaleSetinstance.screenshot.bmp?{saskey}"), - // SerialConsoleLogBlobURI: to.Ptr("https://storageuri/myvmScaleSetinstance.serialconsole.log?{saskey}"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PerformMaintenance_MaximumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPerformMaintenance_virtualMachineScaleSetVMsPerformMaintenanceMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMs_PerformMaintenance_MinimumSet_Gen.json -func ExampleVirtualMachineScaleSetVMsClient_BeginPerformMaintenance_virtualMachineScaleSetVMsPerformMaintenanceMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginPerformMaintenance(ctx, "rgcompute", "aaaaaaaaaa", "aaaa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.json -func ExampleVirtualMachineScaleSetVMsClient_SimulateEviction() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualMachineScaleSetVMsClient().SimulateEviction(ctx, "ResourceGroup", "VmScaleSetName", "InstanceId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand.json -func ExampleVirtualMachineScaleSetVMsClient_BeginRunCommand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineScaleSetVMsClient().BeginRunCommand(ctx, "myResourceGroup", "myVirtualMachineScaleSet", "0", armcompute.RunCommandInput{ - CommandID: to.Ptr("RunPowerShellScript"), - Script: []*string{ - to.Ptr("Write-Host Hello World!")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RunCommandResult = armcompute.RunCommandResult{ - // Value: []*armcompute.InstanceViewStatus{ - // { - // Code: to.Ptr("ComponentStatus/StdOut/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr("Hello World!"), - // }, - // { - // Code: to.Ptr("ComponentStatus/StdErr/succeeded"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armcompute.StatusLevelTypesInfo), - // Message: to.Ptr(""), - // }}, - // } -} diff --git a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go b/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go index 0ec5a12a44eb..1d05512ed17d 100644 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go +++ b/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client.go @@ -47,7 +47,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 2022-11-01 +// Generated from API version 2023-03-01 // - location - The location upon which virtual-machine-sizes is queried. // - options - VirtualMachineSizesClientListOptions contains the optional parameters for the VirtualMachineSizesClient.NewListPager // method. @@ -89,7 +89,7 @@ func (client *VirtualMachineSizesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01") + reqQP.Set("api-version", "2023-03-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 9b8413f6630d..000000000000 --- a/sdk/resourcemanager/compute/armcompute/virtualmachinesizes_client_example_test.go +++ /dev/null @@ -1,89 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcompute_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.json -func ExampleVirtualMachineSizesClient_NewListPager_virtualMachineSizesListMaximumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineSizesClient().NewListPager("-e", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // Value: []*armcompute.VirtualMachineSize{ - // { - // Name: to.Ptr("Standard_A1_V2"), - // MaxDataDiskCount: to.Ptr[int32](2), - // MemoryInMB: to.Ptr[int32](2048), - // NumberOfCores: to.Ptr[int32](1), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](10240), - // }, - // { - // Name: to.Ptr("Standard_A2_V2"), - // MaxDataDiskCount: to.Ptr[int32](4), - // MemoryInMB: to.Ptr[int32](4096), - // NumberOfCores: to.Ptr[int32](2), - // OSDiskSizeInMB: to.Ptr[int32](1047552), - // ResourceDiskSizeInMB: to.Ptr[int32](20480), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/19f98c9f526f8db961f172276dd6d6882a86ed86/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-11-01/examples/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.json -func ExampleVirtualMachineSizesClient_NewListPager_virtualMachineSizesListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineSizesClient().NewListPager("._..", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineSizeListResult = armcompute.VirtualMachineSizeListResult{ - // } - } -}